diff options
Diffstat (limited to 'src/daq/accesslog')
-rwxr-xr-x | src/daq/accesslog/sfive-accesslog.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py index 4d4315f..a98cee1 100755 --- a/src/daq/accesslog/sfive-accesslog.py +++ b/src/daq/accesslog/sfive-accesslog.py @@ -107,7 +107,11 @@ class ClientList: return len(self._clients) def getBytesSent(self): - return sum(self._clients.itervalues()) + sum = 0 + for val in self._clients.itervalues(): + sum += val['bytes-sent'] + + return sum def update(self, linedata): if linedata['status'] != 200 and linedata['status'] != 206: @@ -118,9 +122,10 @@ class ClientList: try: if re.match(self._file_re, linedata['req']['url']): if linedata['client'] in self._clients.keys(): - self._clients[linedata['client']] += linedata['size'] + self._clients[linedata['client']]['bytes-sent'] += linedata['size'] else: - self._clients[linedata['client']] = linedata['size'] + self._clients[linedata['client']] = { 'ip': linedata['client'], + 'bytes-sent': linedata['size'] } except re.error as e: print 'SFive: regex error: %s' % (e) |