I've set you up to rotate daily, but you don't.
But when I do it manually, it does work.
logrotate -vf /etc/logrotate.conf
This is my log file to rotate. /mylogs/log (-rwxrwxrwxrwx 1 admin admin)
This is the system configuration.
/etc/logrotate.conf (-rw-r--r-- 1 root root)
:
/mylogs/log {
create 0640 root utmp
missingok
daily
copytruncate
rotate 10
dateext
}
/etc/logrotate.d/syslog (-rw-r--r-- 1 root root)
:
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null ||
true
endscript
}
/etc/cron.daily/logrotate (-rwx------ 1 root root)
:
#!/bin/sh
/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with
[$EXITVALUE]"
fi
exit 0
/etc/crontab (-rw-r--r--. 1 root root)
:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR
sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
Additional information. CentOS operating system
How can I get it to rotate properly.
UPDATE
I think the problem is in assigning owner, group and permissions of 3 things.
The /mylogs/ folder (root root)
The /mylogs/log file (admin admin)
The create option of logrotate.conf (create 0640 root utmp)
Someone with logrotate running correctly. Please let me know how you have assigned the previous 3 values. the folder - the file - the create config in logrotate.conf