Hi,
We're using Apache Flink 1.9.2 and we've started logging everything as JSON
with log4j (standard log4j1 that comes with Flink). When I say JSON logging, I
just mean that I've formatted in according to:
log4j.appender.console.layout.ConversionPattern={"level": "%p", "ts":
"%d{ISO8601}", "class": "%c", "line": "%L", "message": "%m"}%n
Now I would like to somehow add a field to this JSON to indicate which pipeline
generated the log . At first I thought I'd add another field that logs some
environment variable like such:
log4j.appender.console.layout.ConversionPattern={"level": "%p", "ts":
"%d{ISO8601}", "class": "%c", "line": "%L", "pipeline: "${PIPELINE}",
"message": "%m"}%n
But that doesn't seem to be working (is it because the TM is inited before the
pipeline and that's when the placeholders are set?).
Do you know of a way I could add a field of the current pipeline running? In my
"Main" I have access to the pipeline name and I also have access to this
variable in the tasks themselves. I would prefer not needing to explicitly
using this variable when I log, but that it would be automatic during logging.
If anybody has an idea, I'd love to hear it (we can use logback or anything
else if necessary),
Thanks :)