Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path with query string #66

Open
pillaryj opened this issue Mar 10, 2022 · 3 comments
Open

path with query string #66

pillaryj opened this issue Mar 10, 2022 · 3 comments

Comments

@pillaryj
Copy link

Hi,

First of all, I appreciate this package.
I'd like to try this package in my project, so I wonder if you could help me out.

I hope the path of the message is also displayed as a query string.
I mean, I hope request.get_full_path() is used instead of request.path in the get_log_message function located in your RequestIDMiddleware class.
request.path is very inconvenient to know the exact url because it cuts all the paths behind '/?'.

Would that be possible?

@j4mie
Copy link
Member

j4mie commented Mar 10, 2022

Thanks, that's a good suggestion. I'm not sure if we can just make the change, because some people might be relying on the current behaviour, and sometimes query strings can be very long. Maybe we could add a setting LOG_QUERY_STRING or something. Will get to this when I can.

@alexche-cchange
Copy link

This could be a rabbit hole. It starts with full path, then maybe we need headers somewhere (paging anyone?) and maybe response data, and maybe body (or certain parts of it).

We are doing like this:

  1. At the start, Log Analytics-like message which contains all the necessary details of the request. It already contains request ID. Analytics we route in separate stream.
  2. Log everything else with the request_id only.

Then if/when anything happens, it is easy to spot on the analytics stream, and further investigation only needs a token request_id.

@j4mie
Copy link
Member

j4mie commented Aug 22, 2023

@alexche-cchange thanks for the comment. I think you're in agreement, the suggestion here is to log the query string in the RequestIDMiddleware, which logs a single message per-request (if LOG_REQUESTS is enabled) containing the user ID, request path, method etc. Subsequent logging calls just include the request ID. I'd agree that we definitely don't want to be logging headers or body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants