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

A way to ignore a specific endpoint #412

Closed
badziyoussef opened this issue Dec 19, 2023 · 7 comments
Closed

A way to ignore a specific endpoint #412

badziyoussef opened this issue Dec 19, 2023 · 7 comments

Comments

@badziyoussef
Copy link
Contributor

Sometimes, we have a noisy endpoint that we want just bypass from being logged by RequestMiddleware, is there a way to do that? I have an endpoint massively called by mobile app that polute my logs.

@jrobichaud
Copy link
Owner

Have you considered using log filters?

https://docs.python.org/3/library/logging.html#filter-objects ?

@badziyoussef
Copy link
Contributor Author

No, I didn't, I will try this, thanks for helping.

@mohamedTbarka
Copy link

mohamedTbarka commented Dec 19, 2023

@jrobichaud, can u please give us an example how to use log filters to achieve that ?

@jrobichaud
Copy link
Owner

I do not have any example but I would google it.

You might want to look into this too:
https://www.structlog.org/en/stable/processors.html#filtering

@jrobichaud
Copy link
Owner

maybe this could be an inspiration: #283

@jrobichaud
Copy link
Owner

If you manage to do a clean solution, a recipe could be added to the How-tos of the documentation.

@jrobichaud
Copy link
Owner

Thanks for your contribution.

https://django-structlog.readthedocs.io/en/latest/how_tos.html#filter-logs-from-being-recorded

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