Elastic Search Logs Retention

Hello everyone,
I am using Elastic Search 1.4.2.
We see that elastic search has it's own logging configuration file called logging.yml, which by default has daily file rolling appender.

Is there any configuration available in this file to keep only last 30 days of logs file and remove the older log files?

I tried maxBackupIndex (as suggested on certain blogs), but that resulted in following warning

Please suggest.


Sagar Shah

Is there no setting in elastic search 1.4.2 to handle this log rotation/retention?
I would be surprised to know that.

Sagar Shah

What warning? I believe you forgot to paste the error message.

Sorry about that.

I see following message when starting elastic search with maxBackupIndex property configured in logging.yml file.

log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.

Here's the configuration snippet.

    type: dailyRollingFile
    file: ${path.logs}/${cluster.name}.log
    datePattern: "'.'yyyy-MM-dd"
    maxBackupIndex: 1
      type: pattern
      conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

DailyRolllingFileAppender doesn't have a maxBackupIndex configuration knob, it's RollingFileAppender that has it. If you can't switch, consider using a custom appender (a quick googling indicated that there might be a few ones you can use) or add a simple cronjob that deletes old files.

1 Like

That helps!
Appreciate your inputs!