logrotate for /var/log/cron not working?
Hi i have added the following lines in /etc/logrotate.d/syslog-ng to make /var/log/cron rotate.
/var/log/cron {
rotate 1
size=1k
nocompress
postrotate
/bin/killall -HUP syslog-ng 2>/dev/null || true
endscript
}
After i do this, it is found that logrotation for /var/log/cron is not happening. Moreover the logrotation for other files which used to work earlier before adding this piece of code also does not work. I have included the file /etc/logrotate.d/ in /etc/logrotate.conf
Where am i going wrong ?
My original /etc/logrotate.d/syslog-ng is given below
/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
}
# -开发者_Go百科------------------ 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
}
All your other directives have /usr/bin/killall
.
The cron
directive has /bin/killall
. Maybe that's the reason?
In any case, run
logrotate -d /path/to/your/script
And look for clues in its output.
精彩评论