After installing a new CentOS 6.0 server, logrotate was working absolutely fine. Then one day due to a kernel panic, the server had to be hard booted, and ever since log rotation is not rotating the logs.
So I did a separate cron entry to rotate logs manually and forcefully and redirected the output to a log file, and got the following lines for each file:
rotating pattern: /home/mail3/log/popMailProcessing.log forced from command line (60 rotations)
empty log files are rotated, old logs are removed
considering log /home/mail3/log/popMailProcessing.log
error: stat of /home/mail3/log/popMailProcessing.log failed: Permission denied
However, if I do a logrotation manually from command line, it works flawlessly. The command I use on command line is:
logrotate -v -f /etc/logrotate.d/mail3-logs
My logrotate.conf file is:
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
The log rotation file which logrotate uses via cron job is:
dateext
/home/mail3/log/pop.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/oc4j.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/incoming.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/mailpro.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/imap.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/outgoing.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/smtpout.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/retry.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/mailinglist.log {
daily
rotate 60
copytruncate
compress
}
/home/mail3/log/migrate.log {
daily
rotate 60
copytruncate
compress
}
My crontab entry is:
03 00 * * * root /usr/sbin/logrotate -f -v /etc/logrotate.d/mail3-logs &>> /var/log/logrotate/rotate.log
SELinux is enforcing, and it was enforcing prior to the hard boot too. The directory where the logs are kept have the root as their owner and directory has complete permissions.
Any clue what is causing the permission denied error?