Configure Kubernetes logs in different path with Spring Logback Configure Kubernetes logs in different path with Spring Logback kubernetes kubernetes

Configure Kubernetes logs in different path with Spring Logback


You need to:

  1. move that file onto an emptyDir volume (or hostPath I guess but use emptyDir) and then
  2. run fluentd/bit as a sidecar which reads from that volume and
  3. forwards to the rest of your fluentd setup.


  1. In the dockerfile for the spring boot app create a directory where logs will be written
  2. In the logback xml file have a FileAppender which will write logs in that directory path
  3. Have the logback xml file as part of the jar file in resources folder.
  4. Add Fluentd sidecar into the pod spec of the spring boot app
  5. Configure Fluentd sidecar to tail logs from the log file written in that directory path.