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.
- 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
-
The rotatelogs2 program does not terminate processes when the SIGTERM, SIGUSR1, and SIGHUP signals are received. Processes will terminate when the control process and the server process terminate.
-
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@linux.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.