-
I am using the Some additional context:
My current config outputs <JsonTemplateLayout eventTemplateUri="classpath:GcpLayout.json">
<EventTemplateAdditionalField
key="logging.googleapis.com/trace_sampled"
format="JSON"
value='{"$resolver": "pattern", "pattern": "%equals{%equals{%mdc{trace_flags}}{01}{true}}{00}{false}"}'
/>
</JsonTemplateLayout> Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@aabmass, I don't think this is possible using Create your own event template resolver✓ Complexity: 1/10 This is something you can easily do yourself. Add a flag to
|
Beta Was this translation helpful? Give feedback.
@aabmass, I don't think this is possible using
PatternResolver
– see itsresolve()
method usesJsonWriter#writeString()
, which effectively will encode thePatternLayout
output. There are a couple of approaches I can think of to address your use case:Create your own event template resolver
✓ Complexity: 1/10
✓ You will have the full control
✓ Doesn't require a change on the Log4j side
❌ You need to deliver Java code next to the Log4j configuration
This is something you can easily do yourself.
Add a flag to
PatternResolver
to injectPatternLayout
output without encoding it✓ Complexity: 1/10
❌ Requires a change on the Log4j side
I am not a big fan of
PatternResolver
in general. It literall…