From 0c638194c0eb538db3e9b51d59c252de86e0f974 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 13 May 2015 17:04:54 -0700 Subject: [PATCH] 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 --- manifests/init.pp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 3155acb..5e2ffad 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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'], + } }