Cleanup old ES logs

Keep elasticsearch from fillings its disk with logs by deleting logs
older than two weeks. Note we do not use logrotate because elasticsearch
expects to be doing the log rotation itself, it just doesn't delete
older logs. Instead we setup a cron with find to delete the older logs.

Change-Id: Ia2611cbf6e4aa1945ec8b3914d7ba042d2a7b0c1
This commit is contained in:
Clark Boylan 2015-05-13 17:04:54 -07:00
parent da4dbde4fe
commit 0c638194c0
1 changed files with 9 additions and 0 deletions

View File

@ -124,4 +124,13 @@ class elasticsearch (
group => 'root',
mode => '0644',
}
cron { 'cleanup-es-logs':
command => 'find /var/log/elasticsearch -type f -mtime +14 -delete',
user => 'root',
hour => '6',
minute => '7',
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
require => Package['elasticsearch'],
}
}