summaryrefslogtreecommitdiff
path: root/src/daq/accesslog
diff options
context:
space:
mode:
Diffstat (limited to 'src/daq/accesslog')
-rwxr-xr-xsrc/daq/accesslog/sfive-accesslog.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py
index 0e68497..3d45d61 100755
--- a/src/daq/accesslog/sfive-accesslog.py
+++ b/src/daq/accesslog/sfive-accesslog.py
@@ -211,15 +211,19 @@ class AccessLog():
return linedata
def _updateClients(self, clients, linedata):
- if linedata['status'] != 200 or linedata['req']['cmd'] != 'GET':
+ if linedata['status'] != 200 and linedata['status'] != 206:
+ return
+ if linedata['req']['cmd'] != 'GET':
return
- # TODO: this currently counts all data downloaded from 'client'
-
- if linedata['client'] in clients.keys():
- clients[linedata['client']] += linedata['size']
- else:
- clients[linedata['client']] = linedata['size']
+ try:
+ if re.match(self._file_re, linedata['req']['url']):
+ if linedata['client'] in clients.keys():
+ clients[linedata['client']] += linedata['size']
+ else:
+ clients[linedata['client']] = linedata['size']
+ except re.error as e:
+ print 'SFive: regex error: %s' % (e)
def _sendLogData(self, data, lastts):
cnt = 0
@@ -232,7 +236,8 @@ class AccessLog():
if not lastts:
lastts = linedata['ts']
nextts = lastts + datetime.timedelta(seconds=self._duration)
- clients = { linedata['client'] : linedata['size'] }
+ clients = { }
+ self._updateClients(clients, linedata)
else:
while linedata['ts'] > nextts:
self._sendDataset(nextts, self._duration, len(clients), sum(clients.itervalues()))