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

Ubuntu Playlist:

On this page, we offer quick access to a list of videos related to Ubuntu Linux.

Don't forget to subscribe to our youtube channel named FKIT.

Ubuntu Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Ubuntu linux.

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.

Copy to Clipboard

This behavior is set by the /etc/crontab file.

Here is content of the default crontab file:

Copy to Clipboard

You need to change the following line to a new schedule:

Copy to Clipboard

Change the scheduled time from 06:25 to the desired time.

Here is an example of daily log rotation changed to midnight.

Copy to Clipboard

As a good practice, reboot your computer.

# reboot

You have successfully finished the logrotation configuration.