Raf's Lab
Thursday May 27, 2010
Achieving Log Rotate for Apache access files
If you would like to apply some form of date nomenclature to your Apache HTTPd log files (Apache Tomcat already includes decent filenames which include dates) and also apply a LogRotate, there is a very different approach from Apache 1.3 to Apache 2.2.
Apache 1.3 used to use the mod_logs_rotate module, but this has now been hived off into a separate application.
To achieve the same result use the following in your httpd.conf
CustomLog "|bin/rotatelogs access-logs.%Y-%m-%d-%H_%M_%S.log 5M" combined
If you look at the first portion, we have a | (pipe) to the binary application rotatelogs which should tell the program to send all output to the rotatelogs application (this is installed by default with an Apache HTTPd install). The last bit about 5M, tells Apache to ensure that the log files are maintained at 5 Mb and then rotated.
Further information can be found here http://httpd.apache.org/docs/2.0/programs/rotatelogs.html
Posted at 06:19PM May 27, 2010 by Rafez in Programming | Comments[0]
Comments:
