我对 syslog-ng 旋转系统有疑问。
我需要我的文件轮换每天安排一次,例如:
-rw-r----- 1 root adm 37K Oct 16 192.168.40.240.log
-rw-r----- 1 root adm 83K Oct 15 192.168.40.240.1.log.gz
-rw-r----- 1 root adm 50K Oct 14 192.168.40.240.2.log.gz
但现在的结果是:
-rw-r----- 1 root adm 28K Oct 16 06:23 172.20.252.15.log
-rw-r----- 1 root adm 37K Oct 16 06:21 192.168.40.240.log
-rw-r----- 1 root adm 38K Oct 16 06:21 192.168.40.241.log
-rw-r----- 1 root adm 5.3K Oct 16 06:57 192.168.50.229.log
-rw-r----- 1 root adm 76K Oct 16 06:21 192.168.50.240.log
-rw-r----- 1 root adm 241K Oct 16 07:04 192.168.50.241.log
文件 /etc/logrotate.d/syslog-ng 的内容
/var/log/zlog/*.log
{
rotate 3
daily
missingok
notifempty
compress
postrotate
invoke-rc.d syslog-ng reload > /dev/null
endscript
}
/var/log/syslog
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
invoke-rc.d syslog-ng reload > /dev/null
endscript
}
/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
/var/log/error
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
invoke-rc.d syslog-ng reload > /dev/null
endscript
}
有人能帮助我吗?
谢谢