How to change the log format of Uvicorn access logs? #5644
Replies: 1 comment
-
|
Hi @psheichelberg! I'm Dosu and I’m helping the keep team. You're correct — the Uvicorn access log format is currently hardcoded and cannot be changed to JSON via configuration. The "uvicorn_access": {
"format": "%(asctime)s - %(otelTraceID)s - %(threadName)s - %(message)s"
}The good news is that Keep already has a "uvicorn_access": {
"()": CustomJsonFormatter,
"fmt": "%(asctime)s %(message)s %(otelTraceID)s %(threadName)s",
"rename_fields": {
"asctime": "timestamp",
"otelTraceID": "logging.googleapis.com/trace",
},
}This would be a reasonable feature request if you'd like to open one — the infrastructure is already there, it's just not wired up for access logs. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to change the format of the access logs to JSON (open_telemetry).
I had a look at the source code and it seems to me that the log format of the Uvicorn access cannot be changed: https://github.com/keephq/keep/blob/v0.49.0/keep/api/logging.py#L377_L380
But maybe I am missing or misunderstanding something.
Is there a way to change the log format of the access logs to JSON?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions