You will occasionally need to rotate your web server log files to keep them from taking up unnecessary disk space. Some log analyzers can do this for you, or you can use one of the tools listed below.
One rotation solution is rotatelogs -- an Apache script designed to rotate your web server log files on a regular basis. You can load it directly in your Apache configuration file (/www/conf/httpd.conf) by modifying the TransferLog to look similar to the following:
TransferLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access_log 86400"
For more information about using rotatelogs, access the man page by running man rotatelogs from the server command prompt.
Another possible solution is savelogs -- a complete web server log rotation program. It can rename, archive, compress, and delete log files as well as provide newsyslog-type log rotation (see newsyslog(8) for details). Options can be specified on the command line or in a configuration file. savelogs can also search your web server configuration file and automatically rotate logs defined there.
To install savelogs, connect to your server via SSH, su to root, and run the following command:
(t)csh shell users may have to rehash their path before running savelogs or viewing the man page:
A sample configuration file is located in /usr/local/etc/savelogs.conf.sample. If you wish to use the configuration file, we recommend renaming it to /usr/local/etc/savelogs.conf so you can carry your configuration over to future versions of savelogs.
To view the man pages enter the following:
To view the rotation man page enter the following: