Added clientIp and userAgent to logs
diff --git a/demo/dashboard/files/twisted_app.py b/demo/dashboard/files/twisted_app.py
index e6c1fe0..2051c85 100644
--- a/demo/dashboard/files/twisted_app.py
+++ b/demo/dashboard/files/twisted_app.py
@@ -167,7 +167,9 @@
else:
return settings['allow_origin']
-def log_json(data):
+def log_json(request, data):
+ data['clientIp'] = request.getClientIP()
+ data['userAgent'] = request.getHeader('User-Agent')
if ('useraleVersion' in data) and (data ['useraleVersion'].split('.')[0] == '4'):
logger_js.info(simplejson.dumps(data))
elif ('useraleVersion' in data) and (data['useraleVersion'].split('.')[0] == '3'):
@@ -194,9 +196,9 @@
try:
if isinstance(data, list):
for datum in data:
- log_json(datum)
+ log_json(request, datum)
else:
- log_json(data)
+ log_json(request, data)
except Exception as e:
logger_err.error(e)