1
嗨,我在/etc/logrotate.d/syslog-ng中添加了以下行以使/ var/log/cron旋轉。logrotate for/var/log/cron不工作?
/var/log/cron {
rotate 1
size=1k
nocompress
postrotate
/bin/killall -HUP syslog-ng 2>/dev/null || true
endscript
}
我這樣做後,發現/ var/log/cron的logrotation沒有發生。此外,在添加這段代碼之前曾經工作過的其他文件的日誌記錄也不起作用。我在/etc/logrotate.conf中包含了/etc/logrotate.d/文件
我在哪裏出錯了?下面
/var/log/cmm/cmm/error.log {
rotate 5
compress
size=100k
postrotate
/usr/bin/killall -HUP syslog-ng 2> /dev/null || true
endscript
}
# ------------------- rotate and move user.log
/usr/local/data/log/user.log {
rotate 10
compress
size=1000k
missingok
}
/tmp/log/user.log {
rotate 1
nocompress
size=100k
postrotate
/usr/bin/killall -HUP syslog-ng 2> /dev/null || true
cat /tmp/log/user.log.1 >> /usr/local/data/log/user.log
endscript
}
# ------------------- rotate and move debug.log
/usr/local/data/log/debug.log {
rotate 32
compress
size=1000k
missingok
}
/tmp/log/debug.log {
rotate 1
nocompress
size=100k
postrotate
/usr/bin/killall -HUP syslog-ng 2> /dev/null || true
cat /tmp/log/debug.log.1 >> /usr/local/data/log/debug.log
endscript
}
您錯過了「postrotate」和「endscript」指令。 – Piskvor 2010-12-09 14:43:15