Configuring logrotate for yum

Every time you use yum to install and/or update packages, it logs to /var/log/yum.log. A lot of people don't want to rotate the file a lot as they believe (incorrectly) that it is their only source to the history of their yum tasks. They may even believe that it provides a way to restore your rpm database if it gets corrupted - it does not.

I do recommend keeping your complete yum history as it doesn't grow a lot, unless you reinstall packages a lot.

For a rich interface to your yum history, I suggest you use yum history.

By default, your yum log file is rotated yearly, and even then, it only rotates if the size of your log file exceeds 30 KB, and your logs are only kept for 4 years. Usually, this is enough in the physical world as physical servers tend to be replaced every 3-4 years. However, virtual servers have the potential to stay "alive" beyond these 3-4 years.

How to do it…

Modify /etc/logrotate.d/yum to the following:

/var/log/yum.log {
    missingok
    notifempty
    size 30k
    rotate 1000
    yearly
    create 0600 root root
}

How it works…

This configuration will only rotate the yum log when it exceeds 30 KB in size on a yearly basis, and it will keep 1000 rotated logs, which is basically log files for 1000 years!

See also

For more information on how to use and configure logrotate, refer to the logrotate(8) man page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset