Maintain IBM HTTP Server logs | IBM HTTP Server Plug-in


IBM HTTP Server logs (Apache logs)


+

Search Tips   |   Advanced Search


Overview

If you have turned logging on (see 18.1.2, Access log), you need to make sure that there is enough disk space for the access and error logs. As the amount of information in the access log can grow very large, you should also periodically rotate the log files by moving or deleting the existing logs. There are two ways of doing this:


Graceful restart

By using a graceful restart, you can instruct IBM HTTP Server to open new log files without losing any existing or pending connections from clients. However, in order to accomplish this, the server must continue to write to the old log files while it finishes serving old requests. Therefore, you need to wait for some time after the restart before doing any processing on the log files. A typical scenario that simply rotates the logs and compresses the old logs to save space is shown in Example 27-1.

cd WC_Install_Dir/instances/Instance_Name/httplogs
mv access_log access_log.old
mv error_log error_log.old
IHS_Install_Dir/bin/apachectl -k graceful -f WC_Install_Dir/instances/Instance_Name/httpconf/httpd.conf
sleep 600
gzip access_log.old error_log.old

You may use the cron utility to regularly execute scripts on UNIX systems.


Log piping

The executable...

IHS_Install_Dir/bin/rotatelogs
...can be used to rotate the access and error logs. To use it, open...

WC_Install_Dir/instances/Instance_Name/httpconf/httpd.conf

...and modify the CustomLog and ErrorLog directives.

CustomLog "| IHS_Install_Dir/bin/rotatelogs WC_Install_Dir/instances/Instance_Name/httplogs/access_log.%Y%m%d 86400" common

ErrorLog "| IHS_Install_Dir/bin/rotatelogs WC_Install_Dir/instances/Instance_Name/httplogs/error_log.%Y%m%d 86400"

This example would create a new access log every day and append the current date to the name, for example, access_log.20070724.

You still need to regularly execute operating system scripts that archive or remove the rotated logs, but you do not need to restart the Web server.

To use the syntax shown above for log piping, IBM HTTP Server Version 6.0.2.1 or later is required.