Internet Servers Inc
Internet Servers Inc


How Do I Rotate My Virtual Web Server Log Files?

You can use the rotatelogs utility to rotate your Virtual Server web server log files. Basically, rotatelogs is a wrapper that you include in the Log definitions in the /www/conf/httpd.conf file on your Virtual Server:
  TransferLog "| /usr/bin/rotatelogs /www/logs/access_log 86400"
This creates the files /www/logs/access_log.nnnn where nnnn is the system time at which the log starts (system time is the number of seconds that have elapsed since January 1, 1970). At the end of each rotation time (here after 24 hours) a new log is started.

In order to use the rotatelogs wrapper you must copy the rotatelogs executable into your local directory structure. To do this, telnet or ssh to your Virtual Server and execute the following command:

You can rotate the other web server log files as well:

  AgentLog "|rotatelogs /www/logs/agent_log 86400"    
  RefererLog "|rotatelogs /www/logs/referer_log 86400"
  ErrorLog "|rotatelogs /www/logs/error_log 86400"