Elastic Search Logs Retention


(Sagar) #1

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.

Appreciate!

Regards,
Sagar Shah


(Sagar) #2

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

Regards,
Sagar Shah


(Magnus Bäck) #3

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


(Sagar) #4

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.

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

(Magnus Bäck) #5

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.


(Sagar) #6

That helps!
Appreciate your inputs!


(system) #7