[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need some pointers on logrotate script..



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 :)