-
Notifications
You must be signed in to change notification settings - Fork 45
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
How to add custom fields #26
Comments
Yes, but how you can do that without modifying the existing code. The proof of concept I'm trying to achieve is to replace filebeat with just a log4j2 appender, but it misses those data, and I can't modify the code of the application. What I could do is to provide Environment properties and give it to Log4j2 via the configuration. |
You can do that using configuration. Just switch to Log4j2 |
Thanks :) |
In my opinion, you should also remove jsonIgnore in LogEventJacksonJsonMixIn and avoid renaming threadName by thread. It tooks me some times to understand why not all attribute (including context) was hidden in the Json message. |
Good point on the Thankfully, you can augment any part of the output quite easily with |
Is 1.4 coming? Just thinking whether to wait for VirtualProperty or try to use KeyValuePair |
Yes. 1.4 should be out soon. It got heavily delayed due to |
Could you add an example of JsonLayout to docs? Simply replacing JacksonJsonLayout with JsonLayout doesn't error out but doesn't push anything to Elastic either, was wondering whether I missed something. |
@ricsil Sure, will do. Could you post your updated configuration in the meantime? |
So, this works fine (mix-in is there for timestamp override)
Replacing JacksonJson with Json doesn't produce anything
On the other hand, replacing JacksonJsonLayout with EcsLayout (not forgetting to add dependency) works fine:
https://github.com/elastic/ecs-logging-java/tree/master/log4j2-ecs-layout Also, EcsLayout supports KeyValuePair in case someone needs it. |
@ricsil you need |
|
Hi,
Would it be possible to add custom field value only in the Json message to elastic?
For example, it would be good to add the name or ip of the host, so that you can recognize where comes the log.
Thanks.
The text was updated successfully, but these errors were encountered: