This repository was archived by the owner on Dec 21, 2024. It is now read-only.
This repository was archived by the owner on Dec 21, 2024. It is now read-only.
Cannot rename fields unless they're present in every log record #171
Description
I tried the following configuration to get field names matching the OpenTelemetry semantic conventions:
json:
(): pythonjsonlogger.jsonlogger.JsonFormatter
rename_fields:
otelTraceID: trace_id
otelSpanID: span_id
otelServiceName: service.name
levelname: severity
message: body
threadName: thread.name
exc_type: exception.type
exc_val: exception.message
traceback: exception.stacktrace
pathname: code.filepath
lineno: code.lineno
funcName: code.function
format: '%(levelname)s %(name)s %(threadName)s %(message)s %(pathname)s %(lineno)s %(funcName)s'
It would not work because some of these fields were not present in every log record, but the field rename function requires cannot handle missing fields. In particular, renaming the exception related fields is impossible.
Metadata
Metadata
Assignees
Labels
No labels