diff options
Diffstat (limited to 'src/daq/nginx-lua/s5-nginx-lua-fetch.py')
-rwxr-xr-x | src/daq/nginx-lua/s5-nginx-lua-fetch.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/daq/nginx-lua/s5-nginx-lua-fetch.py b/src/daq/nginx-lua/s5-nginx-lua-fetch.py index e096d1e..924b1a9 100755 --- a/src/daq/nginx-lua/s5-nginx-lua-fetch.py +++ b/src/daq/nginx-lua/s5-nginx-lua-fetch.py @@ -147,11 +147,13 @@ class ClientList: return self._clients.itervalues() def update(self, logdata): - if logdata['client'] in self._clients.keys(): - self._clients[logdata['client']]['bytes-sent'] += logdata['bytes-sent'] + key = '%(client)s/%(ua)s' % logdata + if key in self._clients.keys(): + self._clients[key]['bytes-sent'] += logdata['bytes-sent'] else: - self._clients[logdata['client']] = { 'ip': logdata['client'], - 'bytes-sent': logdata['bytes-sent'] } + self._clients[key] = { 'ip': logdata['client'], + 'user-agent': logdata['ua'], + 'bytes-sent': logdata['bytes-sent'] } class NGXLuaFetcher(): |