Creating a Rotating Log File
A rotating log is one that allows you to set a file size limitation, limit the number of timestamped files, and perform cleanup on old timestamped files as specified. It maintains log entries across Agent restarts. You can designate the maximum size of files to maintain, the number of old timestamped files to keep in a directory, and whether or not to cleanup old timestamped entries.
The properties and their available values are:
mode
append or overwrite
measurement
bit, byte, kb, mb, gb
measuresize
Any number corresponding to the measurement type
cleanup
y or n
logfilenum
The number of timestamped log files to keep in a directory.
logdir
The name of the directory used to maintain log files.
To use the rotating log functionality, remove the comment tags from this section of the loggers.xml file and set the property values as desired.
 
<logger name="rwsf.agent.logfile"
class="rwsf_core.createRotatingFileLogger">
<property name="filename" value="${RWSF_HOME}/logs/agent.log"/>
<property name="formatter" value="rwsf_core.createLogTimeFormatter"/>
<property name="mode" value="append"/>
<property name="measurement" value="mb"/>
<property name="measuresize" value="1"/>
<property name="cleanup" value="y"/>
<property name="logfilenum" value="10"/>
<property name="logdir" value="${RWSF_HOME}/logs"/>
</logger>
For example, these settings will produce a maximum of 10 log files in the ${RWSF_HOME}/logs/ directory of up to 1 mb each, for a total of potentially 10 mb of log information at any one time. The value of cleanup is set to y, so that once the number of files or the file size exceeds the specified limit, old timestamped log files will be removed.
NOTE: WARNING: If cleanup is set to n and mode is set to append, log files will continue to accumulate and user action is required to monitor their size and determine if cleanup is needed.