Add cron to clean out logs

Wildfly by default rotates logs daily for us. It however does not delete
logs after so many days. This leads disk filling up and unhappy servers.

We had similar issues with elasticsearch as well. Rather than sort out
how to configure logging to delete old files (if even possible) we just
added a daily cron entry that uses find to delete files more than 2
weeks old. Run a similar find via cron against the wildfly logs.

Change-Id: Ia6f262afd723aca0a4d6d981326880878436d518
This commit is contained in:
Clark Boylan 2017-06-09 06:39:17 -07:00
parent 1a13f760ed
commit 9228961f0d
1 changed files with 9 additions and 0 deletions

View File

@ -33,4 +33,13 @@ class zanata::wildfly(
java_xmx => '4096m',
require => Package['default-jre-headless'],
}
cron { 'cleanup-wildfly-logs':
command => 'find /opt/wildfly/standalone/log -type f -name \'*.log.*\' -mtime +14 -delete',
user => 'root',
hour => '6',
minute => '7',
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
require => Class['::wildfly'],
}
}