dabapps / django-log-request-id

Django middleware and log filter to attach a unique ID to every log message generated as part of a request
BSD 2-Clause "Simplified" License
371 stars 64 forks source link

Generate/User Log Request id based on header. #62

Closed prashantidealittechno closed 2 years ago

prashantidealittechno commented 2 years ago

Create a new log request id if not passed into the header, otherwise use the log_request_id that passed into the header for log.

In my case I am using the package in microservices to get the same log request id but how can I ensure that it does not generate the new log request id if the endpoint is called from another service and use the same one passed into the header, or ensure that if a new request is created by the user there will be no log request-id and we need to generate a new id.

j4mie commented 2 years ago

Hi 👋🏻 I'm not sure I fully understand the question, but I think what you're looking for is the LOG_REQUEST_ID_HEADER and possibly the GENERATE_REQUEST_ID_IF_NOT_IN_HEADER settings (see the README for details). Does that answer the question?

prashantidealittechno commented 2 years ago

I will add and check if I get the response I needed. Thanks for the quick response.

prashantidealittechno commented 2 years ago

it works thanks