The server provides two log file rotation listeners: the copy log file rotation listener and the summarize log file rotation listener, which can be enabled with a log publisher. 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 will be subject to deletion by a log file retention policy, but the copy will not be automatically removed.
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</screen>
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 will be written there. The server will automatically monitor free disk space
on the target file system and will generate administrative alerts if the amount of free
space gets too low.
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
logger types. Use the following command to create a new summarize log file rotation
$ 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 the
output-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 be deleted. Though files are generally small in comparison to the log files themselves, make sure that there is enough space available in the specified storage directory. The server automatically monitors free disk space on the file system to which the summary files are written.