Would you like to learn how to specify the time of daily log rotate on Ubuntu Linux? In this tutorial, we are going to show how to change the scheduled time of logrotate on a computer running Ubuntu Linux.
• Ubuntu Linux version 18.04
• Ubuntu Linux version 19.04
Tutorial - Change Logrotate Scheduled Time
Daily log rotation files listed inside the /etc/logrotate.d directory are executed between 06 and 07 AM.
Here is an example from the /etc/logrotate.d/apache2 file.
This behavior is set by the /etc/crontab file.
Here is content of the default crontab file:
You need to change the following line to a new schedule:
Change the scheduled time from 06:25 to the desired time.
Here is an example of daily log rotation changed to midnight.
As a good practice, reboot your computer.
You have successfully finished the logrotation configuration.