Pages

Thursday, April 06, 2006

Dual Daemon Postfix log rotate

With dual daemons Posftix, you might want to separate the log file for each daemon.

Let's say the 1st daemon logs to /var/log/maillog and the 2nd daemon logs to /var/log/maillog2, and you want to rotate the log files. I encountered issue when tried to rotate the second log file because maybe the pid of the daemons.

Anyway, I created the second logrotate file /etc/logrotate.d/maillog2 with the following content:

/var/log/maillog2
{
notifempty
daily
rotate 7
compress
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null true
/etc/init.d/postfix reload > /dev/null
/etc/init.d/postfix2 reload > /dev/null
endscript
}

No comments:

Post a Comment