2.6.2 rotatelogs2
rotatelogs2 splits logs by file size and outputs them into multiple files.
Description
rotatelogs2 splits the access log or the error log by log file size, and output the log into multiple files by using the wraparound method. You can specify the rotatelogs2 program in the following directives:
-
CustomLog directive
-
ErrorLog directive
-
HWSRequestLog directive
-
TransferLog directive
Syntax
rotatelogs2 prefix_of_log_files log_file_size number_of_files
- prefix_of_log_files
-
Specify the prefix, as an absolute path, of the log files to be generated after the split.
Logs will be collected into files whose names are in the format prefix.nnn.
nnn is the number of log files, from 001 to the number specified in number_of_files.
If the number of log files is nnn, among the nnn files, the file that had the latest update time when the web server started will be the current log file. The log files are distinguished from other files by adding an extension, from 001 to nnn, to the prefix file name. If the extension of the current log file is mmm and the current log file becomes full, the log file becomes mmm+1, the content of this log file is cleared, and the log is output to this log file. If nnn is the same as nnn, the log is output to the log file 001.
A file prefix.index is created for storing index numbers. This file is used for managing nnn files, and is created when the rotatelogs2 program starts, and is deleted when the program stops. Note that this file might not be deleted due to a reason such as a startup error, but this will not affect the subsequent web server operations.
- log_file_size
-
Specify the maximum size of a log file (unit: KB).
If the log file reaches the maximum size when a log entry is output to the log file, the program clears the next log file and output continues to that file.
- Specifiable values:
-
1 to 2097151
- number_of_files
-
Specify the maximum number of log files to which the log will be output.
If the log file reaches the maximum size and output moves on to the next file, and if the extension of the process log files is the same as the maximum number of files, the program reuses the files from 001.
- Specifiable values:
-
1 to 256
Storage location
installation_directory_for_Application_Server\httpsd\sbin
Example
Specify the directive by using the |program_name format.
Example: This example collects the log into a maximum of five error log files, each of which is a maximum of 4,096 KB:
ErrorLog "|\"\"installation_directory_for_Application_Server/httpsd/sbin/rotatelogs2.exe\" \"installation_directory_for_Application_Server/httpsd/logs/errorlog\" 4096 5\""
In the example, the log is output to the log files in the order from errorlog.001 to errorlog.005. If errorlog.005 reaches 4,096 KB, errorlog.001 is cleared and output continues to that log file. If these log files already exist when the web server starts, the last updated log file will be the log file targeted for output. If this log file already reaches 4,096 KB, the next log file is cleared and output continues to that log file. If the file size is less than 4,096 KB , output continues to the same file.
Notes
-
Do not edit or delete the file for storing index numbers while the rotatelogs2 program is running. If you edit the file, the log might not be output to the log files correctly.
-
If a file with the same name as the file for storing index numbers prefix.index already exists when the web server starts, the file is overwritten.
-
If a problem (for example, due to an incorrect argument) occurs at startup, the web server starts but the rotatelogs2 program does not start. In this case, the rotatelogs2 program outputs a message indicating the following to the event log:
-
Type: error
-
Source: HitachiWebServer
-
Classification: none
-
Event: 3299
-
Description: rotatelogs2.exe: (message)
If this message is output, correct the argument based on the message, and then restart the web server. Note that the same message might be output more than once.
-
-
If you update the latest log file by mistake, the log data cannot be output into the file correctly because the last modified log file is targeted for output when the web server starts.
-
Do not specify a size that is so small that multiple log files reach the specified size within the same second. If you specify such a small size, log files other than the latest file will be targeted for output, and rotation through the files will not take place properly.
-
Do not specify the same prefix for log files at multiple locations within the one of following files.
httpsd.conf
httpsd.conf@windows.vtl
-
If the same prefix for log files is specified at multiple locations, log files other than the latest file will be targeted for output, and rotation through the files will not take place properly.
-
If an argument of the rotatelogs2 program is incorrect, the rotatelogs2 program does not start but the web server starts. In this case, logs are not output. If you specify the rotatelogs2 program, make sure log files are created and split as intended.