diff --git a/config/logrotate b/config/logrotate deleted file mode 100644 index e85511850d43b0e900e00338464ae1df0c80349c..0000000000000000000000000000000000000000 --- a/config/logrotate +++ /dev/null @@ -1,9 +0,0 @@ -/var/log/sysSentry/*.log { - compress - missingok - notifempty - copytruncate - rotate 2 - size +4096k - hourly -} diff --git a/config/logrotate-sysSentry.conf b/config/logrotate-sysSentry.conf new file mode 100644 index 0000000000000000000000000000000000000000..cf5f9947802821fbe54d5cb469cde069e3f92d31 --- /dev/null +++ b/config/logrotate-sysSentry.conf @@ -0,0 +1,35 @@ +# keep 4 hours worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# compress log files +compress + +# if a log file does not exist, go no to the next one without an error msg +missingok + +# do not rotate the log if it is empty +notifempty + +copytruncate + +# ignore any following matches of a log file. +# Note that order is significant, it will not overwrite and take the first match. +# require logrotate >= 3.21.0 +ignoreduplicates + +/var/log/sysSentry/sysSentry.log { + rotate 8 + size +4096k +} + +/var/log/sysSentry/cpu_sentry.log { + rotate 2 + size +2048k +} + +/var/log/sysSentry/*.log { + size +4096k +} diff --git a/src/sh/logrotate-sysSentry.cron b/src/sh/logrotate-sysSentry.cron new file mode 100644 index 0000000000000000000000000000000000000000..64d02f9cf8fb6fc36e6952cae4dca750090f98bc --- /dev/null +++ b/src/sh/logrotate-sysSentry.cron @@ -0,0 +1,13 @@ +#!/bin/sh + +TMPF=`mktemp /tmp/logrotate-sysSentry.XXXXXXXXX` + +/usr/sbin/logrotate /etc/logrotate-sysSentry.conf -v --log=$TMPF -s /var/lib/logrotate-syssentry/logrotate.status +EXITVALUE=$? +if [ $EXITVALUE != 0 ]; then + /bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE], for details, see /var/log/sysSentry/logrotate.log" + /bin/logger -t logrotate -f $TMPF +fi +rm -rf $TMPF +rm -rf /var/lib/logrotate-syssentry/logrotate.status +exit $EXITVALUE