Description
This request applies to all all Json layouts:
- https://github.com/apache/logging-log4j2/tree/master/log4j-layout-jackson-json
- https://github.com/apache/logging-log4j2/tree/master/log4j-layout-jackson
- https://github.com/apache/logging-log4j2/tree/master/log4j-layout-template-json
The layouts in this folder:
https://github.com/apache/logging-log4j2/tree/master/log4j-layout-template-json/src/main/resources
OutputĀ a structure that looks like this:
{ "instant": { }, "thread": { }, "level": { }, "loggerName": { }
Add a set of new templates and/or a config value to set a root element. Default could be "logEvent" but could be overridden to something else like "data":
{ "data": { "instant": { }, "thread": { }, "level": { }, "loggerName": { }
A root element (sometimes?) makes it easier to extract data in 3rd party tools like Splunk's spath command:
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath
Maybe its as simple as calling withRootName?
final ObjectWriter writer = mapper.writer().withRootName("rootName");
Attachments
Issue Links
- links to