How to manage web server log files on VPS v2

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.

Rotatelogs

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.

Savelogs

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.

Installation

To install savelogs, connect to your server via SSH, su to root, and run the following command:

vinstall savelogs

(t)csh shell users may have to rehash their path before running savelogs or viewing the man page:

rehash

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.

Documentation

To view the man pages enter the following:

man savelogs

To view the rotation man page enter the following:

man rotation




Article Details

Last Updated
28th of December, 2011

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Quick Edit

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?



Thank you for rating this answer.

Related Articles

Attachments

No attachments were found.

Post a comment

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Name:
   Email:
* Comment:
* Enter the code below:
 

Continue
Get tips on how to improve your website strategy and more...