oreilly.comSafari Books Online.Conferences.

Apache FAQ
Linux FAQ

Log in to particpate

   Apache FAQ > I. Features
Question:  How can I rotate my log files?

The simple answer: by piping the transfer log into an appropriate log file rotation utility.

The longer answer: In the src/support/ directory, you will find a utility called rotatelogs which can be used like this:

   TransferLog "|/path/to/rotatelogs /path/to/logs/access_log 86400"

to enable daily rotation of the log files.
A more sophisticated solution of a logfile rotation utility is available under the name cronolog from Andrew Ford's site at It can automatically create logfile subdirectories based on time and date, and can have a constant symlink point to the rotating logfiles. (As of version 1.6.1, cronolog is available under the Apache License). Use it like this:

   CustomLog "|/path/to/cronolog --symlink=/usr/local/apache/logs/access_log /usr/local/apache/logs/%Y/%m/access_log" combined

This FAQ is from Apache Server Frequently Asked Questions

Sponsored by: