I added two scripts in "logrotate.d" directory for my application logs to be rotated.
This is the config for one of them:
Quote:
<myLogFilePath> {
compress
copytruncate
delaycompress
dateext
missingok
notifempty
daily
rotate 30
}
|
There is a "logrotate" script in "cron.daily" directory (which seems to be running daily as per cron logs):
Quote:
#!/bin/sh
echo "logrotate_test" >>/tmp/logrotate_test
#/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
/usr/sbin/logrotate -v /etc/logrotate.conf &>>/root/logrotate_error
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
|
The first echo statement is working.
But I find my application logs alone are not getting rotated, whereas other logs like httpd are getting rotated
And I also don't see any output in the mentioned "logrotate_error" file (has write permission for all users).
However the syslog says:
"logrotate: ALERT exited abnormally with [1]"
But when I run the same "logrotate" in "cron.daily" script manually, everything seems working fine.
Why is it not rotating during daily cron schedule? Am I doing something wrong here?
It would be great if I get this much needed help.