diff options
Diffstat (limited to 'src/daq/accesslog')
-rwxr-xr-x | src/daq/accesslog/sfive-accesslog.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py index a98cee1..7e74090 100755 --- a/src/daq/accesslog/sfive-accesslog.py +++ b/src/daq/accesslog/sfive-accesslog.py @@ -113,6 +113,9 @@ class ClientList: return sum + def values(self): + return self._clients.itervalues() + def update(self, linedata): if linedata['status'] != 200 and linedata['status'] != 206: return @@ -260,8 +263,8 @@ class AccessLog(): clients.clear() clients.update(linedata) else: - while linedata['ts'] > nextts: - self._sendDataset(nextts, self._duration, clients) + while linedata['ts'] >= nextts: + self._sendDataset(lastts, self._duration, clients) cnt += 1 lastts = nextts nextts = lastts + datetime.timedelta(seconds=self._duration) @@ -271,7 +274,7 @@ class AccessLog(): # send remaining data if nextts: - self._sendDataset(nextts, self._duration, clients) + self._sendDataset(lastts, self._duration, clients) cnt += 1 except re.error as e: @@ -283,6 +286,7 @@ class AccessLog(): data = { "start-time": timestamp.isoformat('T'), "duration-ms": duration * 1000, "data": { + "clients": list(clients.values()), "client-count": clients.getCnt(), "bytes-sent": clients.getBytesSent() } |