Is it possible to run one iteration of logrotate manually without scheduling it on some interval?
To verify if a particular log is indeed rotating or not and to check the last date and time of its rotation, check the /var/lib/logrotate/status file. This is a neatly formatted file that contains the log file name and the date on which it was last rotated. You'll find this file as /var/lib/logrotate.
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. Any number of config files may be given on the command line.
Note that usually logrotate is configured to be run by cron daily. You have to change this configuration and run logrotate hourly to be able to really rotate logs hourly. As pointed out by yellow1pl the solution is to copy the file /etc/cron. daily/logrotate into the /etc/cron.
Yes: logrotate --force $CONFIG_FILE
logrotate -d [your_config_file]
invokes debug mode, giving you a verbose description of what would happen, but leaving the log files untouched.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With