radut edited a comment on pull request #472: URL: https://github.com/apache/logging-log4j2/pull/472#issuecomment-790543060
`JsonTemplateLayout` is a good idea, you could define specific constants like `"@version": 1`(number) or lets say `"source" : "log4j"`(string). What I am looking for is rewrite the mdc resolver to be able to write numbers as json numbers, instead of string literals, usefull for indexing and searching in ElasticSearch with function like between x and y, without having another transformer on the way. But most importantly I want to be able to pass specific `Markers` with a `JSON/map` attached to logging event, which is very usefull for that specific logging event. Currently it is possible to write only the name of the marker in my case something like `LS_MARKER` (https://github.com/radut/log4j2-logstash-layout/blob/67f3ea74bf061ee27a4c5405c59745a64a663a91/layout/src/main/java/org/apache/logging/log4j/core/LogStashMarker.java) , but instead I want to override the resolver and pull the `JSON` info and write it (eventually flatten) into the same json log event. Something similar I have done in the past here : https://github.com/radut/log4j2-logstash-layout/blob/67f3ea74bf061ee27a4c5405c59745a64a663a91/demo/src/main/java/com/radut/log4j/demo/LoggerMarkerTest.java#L52 with the serializer : https://github.com/radut/log4j2-logstash-layout/blob/67f3ea74bf061ee27a4c5405c59745a64a663a91/layout/src/main/java/org/apache/logging/log4j/core/jackson/MarkerJsonSerializer.java a fork from https://github.com/majikthys/log4j2-logstash-jsonevent-layout. basically there is a `Map<String, Object>` which is serialized as JSON within a field or flattened. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
