在 /etc/logrotate.d 目录中
把syslog文件中的/var/log/maillog字段去除;
新建个maillog文件,在里面写入
/var/log/maillog {
daily
rotate 32
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
运行 /usr/sbin/logrotate -vf /etc/logrotate.d/maillog
以上测试通过
分割邮件日志:
# cat /etc/logrotate.d/maillog
/var/log/maillog {
weekly
missingok
rotate 365
nocompress
copytruncate
notifempty
create 640 root adm
}
/usr/sbin/logrotate /etc/logrotate.conf 运行