Xymon Mailing List Archive search

Need some pointers on logrotate script..

list David Majchrzak
Fri, 15 Jul 2005 18:43:39 +0200
Message-Id: <user-056d002db66b@xymon.invalid>

Hey,

Trying to fix so that my logrotate will add a line at the top after each rotation so that /var/log/messages file wont be empty (dont want to disable lenght checking through bb client - since the log might be emptied if a box is hacked).

This is how my /etc/logrotate.d/syslog looks like:

/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
     sharedscripts
     postrotate
         /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
     endscript
}

This is what I think I should change it to (never touched these kinda files before):

/var/log/messages {
     postrotate
         /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
         echo '### This file has been rotated by logrotate ###' >> /var/log/messages
     endscript
}

/var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
     sharedscripts
     postrotate
         /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
     endscript
}

Will this work?

Thanks in advance for any advice :)