We are using zeebe distributed workflow engine that uses log4j as its logging framework. Its a spring boot application deployed through helm on kubernetes. Unfortunately it does not include log4j-layout-template-json
jar that enables json logging. Any approach that requires third party app code modifications doesn’t look right since the project is under active development. We would need to constantly upgrade the third party app and hence forking it would make deployments tougher.
What are some possible ways to configure it for json logging so that the logs can be shipped to EFK stack?
Thanks
2
Answers
The general solution is simple: you need to add
log4j-layout-template-json
to the classpath of the application and create a Docker image with the additional libraries.The devil is in the details: every distribution has a different method to add libraries to the classpath.
Camunda Zeebe seems to be using Appassembler to create its binary distribution, which uses this script to boot up the application. So you have two choices:
/usr/local/zeebe/lib
and your Log4j Core configuration file to/usr/local/zeebe/config
,CLASSPATH_PREFIX
environment variable accordingly.For example you can add additional Log4j Core modules and a custom configuration file to the
/usr/local/log4j2
directory, with a Docker file like this:I would create my own image for now, then create and issue and a pull request to get the missing dependency into Zeebe, so it will be there in the future.
https://github.com/camunda/zeebe/blob/main/CONTRIBUTING.md