logrotate.conf

I changed the logrotate.conf file to make a new log file to be automatically rotated daily. But after a night, I have not seen the rotated file.

When does this rotation happen? I mean what is the exact time?

In addition, do I have to restart what deamon to make the change take effect?

when the logs rotate is defined in the logrotate.conf, you can see more details with "man logrotate"

logrotate is not a deamon, therefore it does not need restarting.

from the man page:
Normally, logrotate is run as a daily cron job. It will not modify a log more than once in one day unless the criterion
for that log is based on the log's size and logrotate is being run more than once each day, or unless the -f or --force
option is used.

this is the content of my logrotate file for a specific task:

compress
dateext
daily
rotate 7
size 1M
notifempty
missingok
copytruncate

the "daily" statement should indicate that it will rotate each day, namely that a new file will be created each day. however, after several days, I still have only one log file. why?

do you have the logrotate setup on a cron job?

I am not sure, but this is what the "ls /etc/cron*" shows:

ls cron*
cron.deny crontab

cron.d:

cron.daily:
beagle-crawl-system suse-clean_catman suse.de-backup-rpmdb suse.de-clean-tmp suse.de-update-preload
logrotate suse.de-backup-rc.config suse.de-check-battery suse.de-cron-local suse-do_mandb

cron.hourly:
mcelog

cron.monthly:

as logrotate is under cron.daily, I assumed it has been set up.

so as long as inside the cron.daily/logrotate file there is this line: /usr/sbin/logrotate /etc/logrotate.conf

and the cron daemon is running, then it should be working fine.

try running /usr/sbin/logrotate /etc/logrotate.conf

it will rotate the logs, then you can see if it's working at all based on the config file, if not try /usr/sbin/logrotate -f /etc/logrotate.conf

what I have is :

/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF

but the fact is that I still have only one log file there, but there should be a couple of rotated log files right? as I made the configuration a couple of days ago.

did the log file get above 1mb in size? if it didn't then it wouldn't have been rotated.

so if I comment the size statement, it will rotate each day, no matter even nothing happened?

yes, based on your config if your comment out the "size" then the log will be rotated daily and kept back for up to 7 days.

how can I set the exact time for logrotate? e.g. 00:00 each day. where can I do this? /etc/logrotate.conf or crontab? thanks!