Search code examples
elasticsearchlogginglog4j

How to limit size of all elasticsearch logs in logs4j2.properties?


I have default log4j2.properties configuration file and I would like to make the rotation based on file sizes. The maximum disk space for all logs should be 5GB. What is the easiest way to configure it? What lines exactly should I leave in this properties file? How the file should look like? Default file that I've got: https://github.com/elastic/elasticsearch/blob/main/distribution/src/config/log4j2.properties


Solution

  • you can use rolling file appender. You can find detailed example in below link

    https://howtodoinjava.com/log4j2/log4j2-rollingfileappender-example/