Typically, log rotation in Linux occurs daily on the cron. The default configuration file is /etc/logrotate.conf, and the individual log rotation rules for the services are stored in the directory /etc/logrotate.d.
Sometimes it becomes necessary to manually rotate certain files. For example, if you have high traffic server, you need to rotate logs before its default said frequency to avoid bulky files.
In this article, you will learn how to debug and force logrotate manual start.
Tip: All you need to know about
crontab: setting up cron in Ubuntu and CentOS, examples
crontabin Linux, running cron jobs (scripts, commands) every minute, every hour, every day, etc. Read More →
Forced Rotation of Logs
First of all, check what happens when you force it
logrotate(without changing the file system):
$ logrotate -vdf <strong>CONFIG_FILE</strong>
$ logrotate -vf <strong>CONFIG_FILE</strong>
Options passed to the command
|Force to start |
|Show more information.|
Info: Using the option
logrotatewill force the files to rotate, even if they do not fall under certain criteria, like
Join our reader's list to start receiving latest updates.
Get free Tech, Linux tips and resources delivered directly to your inbox.