Disable logrotation

We have our internal infrastructure that takes care of log rotation and because ES has inbuilt log rotation by default, the glob pattern does not match ultimately canceling out any log rotation.

Is there a way to disable log rotation in ES via configuration? If so, can you please provide an example?

1 Like

i found this topic. i hope this can help.

https://discuss.elastic.co/t/log-file-retention-settings/33160/4?u=igormarqs

What version of Elasticsearch?

We are on 5.1.

I read that for 5.3 and onwards, there is a way to rotate file with TimeBasedTriggeringPolicy, where filePattern contains date.

Anyway let me know if there is a way to disable the rotation (may be overwrite log4j2.properties with a blank file?)

I'll be upfront and say first that you are entering unsupported territory, and you are at risk of losing log messages if you switch to using an external rotation strategy. There's no guarantee that when the log file is externally manipulated Log4j transitions seamlessly and you don't lose log messages or have log messages partially written across two files. It doesn't matter if you use a rename/new strategy, or something like copytruncate.

If you insist on doing this, you need to change the appender in the default log4j2.properties configuration from the rolling file appender to a different appender like the file appender, and remove the size-based triggering policy. You'll need to consult the Log4j docs for the specific parameters for your use case.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.