Logrotate Procedure & Policy

From Metro Studios Knowledgebase

Jump to: navigation, search

Contents

[edit] vhost Rotation

In order to keep the individual virutal hosts log file sizes reasonable (so they don't crash our slices) we have to put a custom log rotation script into place.

This only applies to our slices as on the Rackspace servers this is done for us already.

The custom virtual host rotation file is found in /etc/logrotate.d/vhosts and will look like this:

/var/www/vhosts/slice1.metro-studios.com/logs/*log
/var/www/vhosts/m.stlukescr.org/logs/*log
/var/www/vhosts/secure.stlukescr.org/logs/*log
/var/www/vhosts/stlukescr.org/logs/*log
{
        rotate 14
        daily
        compress
        delaycompress
        sharedscripts
        postrotate
                /usr/sbin/apache2ctl graceful > /dev/null
        endscript
}

Basically the only thing you will have to do to add a virtual host into the log rotation script is add the log file's locations (ex: "/var/www/vhosts/example.com/logs/*log") to the top listing and everything else will be taken care of for you.

[edit] rsync.log Rotation (slice backups)

In order to maintain rotation on the slice backup process you will need to add a "rsync" configuration file in the logrotate.d directory. (/etc/logrotate.d/rsync) The contents should be as follows:

/root/backups/rsync.log
{
        rotate 14
        daily
        compress
        delaycompress
        sharedscripts
        endscript
}

[edit] Notes

If you would like to test the new configuration you can do so easily by invoking a verbose debug of logrotate command like this:

sudo /usr/sbin/logrotate /etc/logrotate.conf -vd
Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Knowledgebase
Toolbox