Replies: 1 comment
-
I'd recommend writing a custom |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am working with a situation where I want to log a conditional MDC field if present, but also modify it preserving the "emptiness" if it doesn't exist. For example if the
traceId
exists on the MDC I currently useWhich works fine, but I also want to create another field which is the URL to navigate to the trace ID in Google's Trace Explorer. the URL would be provided as an environment variable and needs to be concatenated with the
traceId
value, but not be present at all if the thetraceId
is omitted.E.g.
However this leads to
"logging.googleapis.com/trace":"projects/foobar/"
if the log doesn't have a trace ID.I have created a modified version of the answer to this similar question: #762
However it seems a little clunky to have a special omission field for something that seems very nearly supported just via the xml:
Does this seem like the correct approach for this problem? Would it be easier to have some sort of log filter that extracts the traceId from the MDC and writes a new variable with the concatenation done already, then just reference that variable?
Beta Was this translation helpful? Give feedback.
All reactions