You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our structure logging currently always adds MDC items. It's possible that user doesn't want them so we should offer a property to disable the feature. We could also offer a way to locate MDC content under a different key (e.g. under labels in ECS logging.
The text was updated successfully, but these errors were encountered:
philwebb
changed the title
Allow structured logging without context elements
Allow structured logging with relocated or disabled context elements
Apr 16, 2025
@philwebb Thanks for this feature, I wanted this for a long time. However, I think that it has a problem by using the same prefix for MDC and key-value pairs.
MDC fits well with ECS's description for labels, which is modelled to only accept keyword (plain Strings, exactly what MDC values are). This is exactly my use case, I want to nest MDC values into labels.
Key-value pairs are structured data, I never used them, but I assume that's what you would use if you wanted to include geodata, for example (as mentioned in the previous issue 45063). And then you really don't want them prefixed, you'd want them in the root.
As you can see, now I have labels.user-id as I need it, but the geodata is labels.geo.city_name, which violates ECS schema for labels (would cause this event to be dropped during ingestion). It would be good if key-pairs could be prefixed differently (like logging.structured.json.mdc.context and logging.structured.json.key-value.context), or at least that only MDC gets prefixed like that and key-pairs are not.
@lauroschuck I've opened #45641 to see what we can do to support this. It's a little interesting because Logback and Log4J have different features and so far we haven't need properties that apply to only one.
Uh oh!
There was an error while loading. Please reload this page.
Our structure logging currently always adds MDC items. It's possible that user doesn't want them so we should offer a property to disable the feature. We could also offer a way to locate MDC content under a different key (e.g. under
labels
in ECS logging.The text was updated successfully, but these errors were encountered: