summaryrefslogtreecommitdiff
path: root/src/daq/accesslog
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-10-14 02:32:52 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-14 02:32:52 +0200
commit0dabed853108440ae0e3c4b2715c9c31eab526e4 (patch)
tree3589cd5e3213b164d2a731883a80aa2e0be0af89 /src/daq/accesslog
parentmoved to dict for client data (diff)
now also list of clients gets reported
starttime vs. endtime
Diffstat (limited to 'src/daq/accesslog')
-rwxr-xr-xsrc/daq/accesslog/sfive-accesslog.py10
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()
}