-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add support for log4j2 property substitution and lookup variables #188
Comments
This sounds like an interesting feature, but not sure how soon we can prioritize it. Without looking into how it's implemented, I would first look for an access to the internal log4j2 code that parses, substitutes and does the lookup. I doubt if we would like to add the entire logic (and documentation) to do it within the ECS-logging library. Another hint if you try it out is that it will have to be compatible with all supported versions (2.6+). |
As a workaround, you could set these properties as key/value pairs that already support lookups: <EcsLayout serviceName="myservice">
<KeyValuePair key="service.version" value="$${spring:project.version}"/>
<KeyValuePair key="service.node.name" value="${env:HOSTNAME}"/>
</EcsLayout> |
Great workaround @felixbarny! And thanks to have added this example into documentation! |
Setting However, setting ecs-logging-java/log4j2-ecs-layout/src/main/java/co/elastic/logging/log4j2/EcsLayout.java Line 177 in 260992b
<KeyValuePair key="service.environment" value="${sys:environment}" /> This prevents lookups (i.e. What's the recommendation here? Simply not setting |
Hi,
EcsLayout
component is great for log4j2.But for now, we can't inject dynamic values in
EcsLayout
attributes.For instance;
serviceVersion
andserviceNodeName
So it would be great to add support for log4j2 property substitution and lookup variables in EcsLayout attributes!
It would allow to write this EcsLayout configuration for instance:
The text was updated successfully, but these errors were encountered: