Search code examples
kubernetestomcatlogginglogback

Write Logfiles to Slow Disk or sending Tomcat Access Logs to ElasticSearch?


  • My service (tomcat/java) is running on a kubernetes cluster (AKS).
  • I would like to write the log files (tomcat access logs, application logs with logback) to an AzureFile volume.
  • I do not want to write the access logs to the stdout, because I do not want to mix the access logs with the application logs.

Question

I expect that all logging is done asynchronously, so that writing to the slow AzureFile volume should not affect the performance. Is this correct?

Update

In the end I want to collect the logfiles so that I can send all logs to ElasticSearch.

Especially I need a way to collect the access logs.


Solution

  • If you want to send your access logs to Elastic Search, you just need to extend the AbstractAccessLogValve and implement the log method.

    The AbstractAccessLogValve already contains the logic to format the messages, so you need just to add the logic to send the formatted message.