diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-10-20 04:28:16 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-10-20 04:28:16 +0200 |
commit | 4db8daf6c89c4ee569377b7d224b34617fe68135 (patch) | |
tree | 6ffad6d8460803e14fa3193083e81a1aa8cc4d6f /src/daq/nginx-lua/s5-nginx-lua-fetch.py | |
parent | sending actual data works now (diff) |
clients are now unique by (ip|ua)
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(): |