Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run one logrotate check manually?

Is it possible to run one iteration of logrotate manually without scheduling it on some interval?

like image 237
Vladimir Avatar asked Jan 22 '10 14:01

Vladimir


People also ask

How do you check logrotate runs?

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.

How often does logrotate check size?

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.

How do I run logrotate per hour?

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.


2 Answers

Yes: logrotate --force $CONFIG_FILE

like image 101
pilcrow Avatar answered Oct 07 '22 15:10

pilcrow


logrotate -d [your_config_file] invokes debug mode, giving you a verbose description of what would happen, but leaving the log files untouched.

like image 23
sandover Avatar answered Oct 07 '22 13:10

sandover