4.2.3 Dividing logs (rotatelogs program)

You can divide access logs and error logs by a specific time period (for example, every 24 hours) and output the logs to multiple files. The rotatelogs program can be specified in the following directives:

Specify the program in the following format.

Organization of this subsection
(1) Format
(2) Parameters
(3) How to use
(4) Notes

(1) Format

rotatelogs prefix-for-split-log-file log-splitting-time-interval [-fnum number-of-files] [-diff time-difference-from-GMT]

(2) Parameters

(3) How to use

Use the rotatelogs after specifying " | Program name" format in the TransferLog, CustomLog, and the ErrorLog directives. The rotatelogs splits the log file periodically into separate files to collect the logs.

(Example) Windows version
This example explains how to split the access log after every 24 hours, and to collect the log in the file <Cosminexus-installation-directory>\httpsd\logs\access.nnnnnnnnnn on Windows. The following is the specification, where you set the splitting time as per the Japan Time, and split the log file at every 0 hrs of Japan time:

TransferLog "|\"\"<Cosminexus-installation-directory>/httpsd/sbin/rotatelogs.exe\" \"<Cosminexus-installation-directory>/httpsd/logs/access\" 86400 -diff 540\""

Log file name: <Cosminexus-installation-directory>\httpsd\logs\access.nnnnnnnnnn
Log splitting time interval: 86400 seconds (= 24 hours)
(Example) UNIX version
This example describes how to split the access log after every 24 hours, and to collect the log in /opt/hitachi/httpsd/logs/access.nnnnnnnnnn file on UNIX. The following is the specification, where you set the splitting time as per the Japan Time, and split the log file at every 0 hrs of Japan time:

TransferLog "|/opt/hitachi/httpsd/sbin/rotatelogs /opt/hitachi/httpsd/logs/access 86400 -diff 540"

Log file name: /opt/hitachi/httpsd/logs/access.nnnnnnnnnn
Time interval to divide the log: 86400 seconds ( = 24 hours)

(4) Notes

(a) Notes for the UNIX version
(b) Notes for the Windows version
(c) Common notes for the UNIX and Windows versions