New topics: Your Pet, IOU, Baby IQ, The Poisons, Birther II, Games, Future Power

Welcome to the Tech Space!

Microsoft Related

Skip to end of metadata
Go to start of metadata

Apache Log Rotation

Log rotation using customlog

in the file /etc/httpd/conf/httpd.conf, change customlog to:

CustomLog "|/u01/app/apache/bin/rotatelogs /u01/app/apache/logs/access_log.%Y%m%d 86400 -360" common

(changing the path as needed...)
where the number 86400 is seconds to rotation (86400 is 24 hours)
and -360 is minutes offset from UTC 0 (-360 is for US Central)

and comment out any other line beginning with 'CustomLog'

this will give you logs, rotated daily, named something like:

access_log.20100901
access_log.20100902
access_log.20100903

...so you don't have to stop the server to deal with gigantic log files...

Many Linux distributions now come with a log rotation included. For example, Red Hat 9 comes with logrotate.d, a log rotation daemon which is highly configurable. To find out more, on your Linux system with logrotate.d installed, type man logrotate.

Configuration of logrotate on bobsgear

/etc/logrotate.d/httpd

/var/log/httpd/*log {
    compress
    missingok
    notifempty
    sharedscripts
    dateext
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

/home/confluence.bobsgear/http_logs/*log {
    daily
    rotate 90
    missingok
    notifempty
    sharedscripts
    dateext
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

/home/iplog/logs/*log {
    monthly
    compress
    dateext
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}


Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.