Configuring log rotation listeners
The server provides two log file rotation listener, the copy log file rotation listener and the summarize log file rotation listener, which you can enable with a log publisher.
About this task
Log file rotation listeners allow the server to perform a task on a log file as soon as it has been rotated out of service. Custom log file listeners can be created with the Server SDK.
The copy log file rotation listener can be used to compress and copy a recently-rotated log file to an alternate location for long-term storage. The original rotated log file is subject to deletion by a log file retention policy, but the copy is not automatically removed.
The summarize log file rotation listener invokes the summarize-access-log
tool on a recently-rotated log file and writes its output to a file in a specified location. This provides information about the number and types of operations processed by the server, processing rates and response times, and other useful metrics. Use this with access loggers that log in a format that is compatible with the summarize-access-log
tool, including the file-based-access
and operation-timing-access
logger types.
Steps
-
Use the following command to create a new copy log file rotation listener.
$ dsconfig create-log-file-rotation-listener \ --listener-name "Copy on Rotate" \ --type copy \ --set enabled:true \ --set copy-to-directory:/path/to/archive/directory \ --set compress-on-copy:true
The path specified by the
copy-to-directory
property must exist, and the file system containing that directory must have enough space to hold all of the log files that are written there. The server automatically monitors free disk space on the target file system and generates administrative alerts if the amount of free space gets too low. -
Use the following command to create a new summarize log file rotation listener.
$ dsconfig create-log-file-rotation-listener \ --listener-name "Summarize on Rotate" \ --type summarize \ --set enabled:true \ --set output-directory:/path/to/summary/directory
The summary output files have the same name as the rotated log file, with an extension of
.summary
. If theoutput-directory
property is specified, the summary files are written to that directory. If not specified, files are placed in the directory in which the log files are written.As with the copy log file rotation listener, summary files are not automatically deleted. Although files are generally small in comparison to the log files themselves, make sure that enough space is available in the specified storage directory. The server automatically monitors free disk space on the file system to which the summary files are written.