mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-09 00:45:48 +00:00
🔇(backend) silence expected 401 warnings on /me
On a busy morning, `/me` alone produced 72k warning logs — 97% of all warnings. They all come from anonymous requests to `/me` without credentials, which is normal: `/me` is how the app determines the current auth status. These warnings carry no diagnostic value on this endpoint, so silence them there to cut down on log volume.
This commit is contained in:
@@ -12,6 +12,10 @@ and this project adheres to
|
||||
|
||||
- 🔒️(backend) enforce display name setting on rename API
|
||||
|
||||
### Changed
|
||||
|
||||
- 🔇(backend) silence expected 401 warnings on /me
|
||||
|
||||
## [1.31.0] - 2026-09-08
|
||||
|
||||
### Added
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Logging filters for the core application."""
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
class SilenceExpected401(logging.Filter):
|
||||
"""Drop the expected 401 from anonymous hits on the /me endpoint.
|
||||
|
||||
The frontend probes `/users/me/` to check authentication; a 401 for
|
||||
anonymous users is normal, not a warning worth logging.
|
||||
"""
|
||||
|
||||
def filter(self, record):
|
||||
"""Return False for a 401 on `/users/me`."""
|
||||
if getattr(record, "status_code", None) == 401:
|
||||
request = getattr(record, "request", None)
|
||||
path = getattr(request, "path", "") or ""
|
||||
if path.rstrip("/").endswith("/users/me"):
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -1122,10 +1122,16 @@ class Base(Configuration):
|
||||
"style": "{",
|
||||
},
|
||||
},
|
||||
"filters": {
|
||||
"silence_expected_401": {
|
||||
"()": "core.logging_filters.SilenceExpected401",
|
||||
},
|
||||
},
|
||||
"handlers": {
|
||||
"console": {
|
||||
"class": "logging.StreamHandler",
|
||||
"formatter": "simple",
|
||||
"filters": ["silence_expected_401"],
|
||||
},
|
||||
},
|
||||
# Override root logger to send it to console
|
||||
|
||||
Reference in New Issue
Block a user