json-logging-python icon indicating copy to clipboard operation
json-logging-python copied to clipboard

Can it be made possible to set the User also via a Header if not present?

Open Ben-Bock opened this issue 3 years ago • 1 comments

Hi, great package! Could it made possible to set the User (like correlation-Id)?

Background is that I'm in a situation where I orchestrate some microservices (in my case with Fastapi) and not all of them have/need authentication. But if Service A calls B, C, D, ... it would be very easy to send an Header (e.g. X-User-Id) so that I can use this (like the correlation id) for my distributed logs.

Thx

Ben-Bock avatar Nov 08 '21 09:11 Ben-Bock

you can either use https://github.com/bobbui/json-logging-python#24-log-extra-properties or if you want it be in place of correlation-id you can override the value of CORRELATION_ID_HEADERS to add your own headers

bobevenup avatar Dec 23 '21 01:12 bobevenup