Commit 8e4e9b93 authored by David Foucher's avatar David Foucher

Fix header capitalization and add condition to detect ESD calls

parent bc056815
Pipeline #3473 passed with stage
in 1 minute and 30 seconds
...@@ -45,16 +45,19 @@ def log_simulate(request, response, context, financements=None, errors=None): ...@@ -45,16 +45,19 @@ def log_simulate(request, response, context, financements=None, errors=None):
"version": VERSION, "version": VERSION,
} }
request_logger.info(json.dumps(message, sort_keys=True)) request_logger.info(json.dumps(message, sort_keys=True))
application = request.headers.get('ORIGIN-USER')
if not application and request.headers.get('AUTHORIZATION'):
application = 'esd'
message_esd = { message_esd = {
"startup": "trefle", "startup": "trefle",
"requestId": str(uuid.uuid4()), "requestId": str(uuid.uuid4()),
"date": datetime.utcnow().isoformat(), "date": datetime.utcnow().isoformat(),
"remoteIP": request.headers.get("x-real-ip"), "remoteIP": request.headers.get("X-REAL-IP"),
"httpReferer": request.headers.get("referer"), "httpReferer": request.headers.get("REFERER"),
"httpUserAgent": request.headers.get("user-agent"), "httpUserAgent": request.headers.get("USER-AGENT"),
"status": response.status, "status": response.status,
"apiVersion": VERSION, "apiVersion": VERSION,
"application": request.headers.get('origin-user'), "application": application,
} }
request_esd_logger.info(json.dumps(message_esd, sort_keys=True)) request_esd_logger.info(json.dumps(message_esd, sort_keys=True))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment