Class FileBasedEventHandlerConfiguration.FileRotation
java.lang.Object
org.forgerock.audit.events.handlers.FileBasedEventHandlerConfiguration.FileRotation
- Enclosing class:
- FileBasedEventHandlerConfiguration
Groups the file rotation config parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default file rotation suffix format.static final longThe file size value to use when no maximum is set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuildsRotationPolicyinstances from configuration options.Builds aTimeStampFileNamingPolicyinstance from configuration options.longGets the maximum file size of an audit log file in bytes.Gets the prefix to add to a log file on rotation.Gets the suffix to add to a log file on rotation.Gets the interval to trigger a file rotation.Gets a list of times at which file rotation should be triggered; times should be provided as Strings that can be parsed byDurationthat each specify an offset from midnight.booleanGets log rotation enabled state.voidsetMaxFileSize(long maxFileSize) Sets the maximum file size of an audit log file in bytes.voidsetRotationEnabled(boolean rotationEnabled) Sets log rotation enabled state.voidsetRotationFilePrefix(String rotationFilePrefix) Sets the prefix to add to a log file on rotation.voidsetRotationFileSuffix(String rotationFileSuffix) Sets the suffix to add to a log file on rotation.voidsetRotationInterval(String rotationInterval) Sets the interval to trigger a file rotation.voidsetRotationTimes(List<String> rotationTimes) Sets a list of times at which file rotation should be triggered; times should be provided as Strings that can be parsed byDurationthat each specify an offset from midnight.
-
Field Details
-
NO_MAX_FILE_SIZE
public static final long NO_MAX_FILE_SIZEThe file size value to use when no maximum is set.- See Also:
-
DEFAULT_ROTATION_FILE_SUFFIX
The default file rotation suffix format.- See Also:
-
-
Constructor Details
-
FileRotation
public FileRotation()
-
-
Method Details
-
isRotationEnabled
public boolean isRotationEnabled()Gets log rotation enabled state. By default log rotation is disabled.- Returns:
- True - If log rotation is enabled. False - If log rotation is disabled.
-
setRotationEnabled
public void setRotationEnabled(boolean rotationEnabled) Sets log rotation enabled state. By default log rotation is disabled.- Parameters:
rotationEnabled- True - Enabled log rotation. False - Disables log rotation.
-
getMaxFileSize
public long getMaxFileSize()Gets the maximum file size of an audit log file in bytes.- Returns:
- The maximum file size in bytes.
-
setMaxFileSize
public void setMaxFileSize(long maxFileSize) Sets the maximum file size of an audit log file in bytes.- Parameters:
maxFileSize- The maximum file size in bytes.
-
getRotationFilePrefix
Gets the prefix to add to a log file on rotation. This is only used when time based rotation is enabled.- Returns:
- The prefix to add to the file.
-
setRotationFilePrefix
Sets the prefix to add to a log file on rotation. This is only used when time based rotation is enabled.- Parameters:
rotationFilePrefix- The prefix to add to the file.
-
getRotationFileSuffix
Gets the suffix to add to a log file on rotation. This is only used when time based rotation is enabled. The suffix allows use of Date and Time patterns defined inSimpleDateFormat. The default suffix is "-yyyy.MM.dd-HH.mm.ss".- Returns:
- The suffix to add to the file.
-
setRotationFileSuffix
Sets the suffix to add to a log file on rotation. This is only used when time based rotation is enabled. The suffix allows use of Date and Time patterns defined inSimpleDateFormat. The default suffix is "-yyyy.MM.dd-HH.mm.ss".- Parameters:
rotationFileSuffix- The suffix to add to the file.
-
getRotationInterval
Gets the interval to trigger a file rotation. The interval should be set as aDuration.Examples of valid durations are:
5 seconds 5 minutes 5 hours disabledA value of "zero" or "disabled" means that time based file rotation is disabled.
- Returns:
- The interval duration.
-
setRotationInterval
Sets the interval to trigger a file rotation. The interval should be set as aDuration.Examples of valid durations are:
5 seconds 5 minutes 5 hours disabledA value of "zero" or "disabled" disables time based file rotation.
- Parameters:
rotationInterval- A String that can be parsed as aDuration, specifying rotation interval.
-
getRotationTimes
Gets a list of times at which file rotation should be triggered; times should be provided as Strings that can be parsed byDurationthat each specify an offset from midnight.For example the list of [10 milliseconds, 20 milliseconds, 30 milliseconds] will cause a file rotation to happen 10 milliseconds, 20 milliseconds and 30 milliseconds after midnight.
- Returns:
- The list of durations after midnight that rotation should happen.
-
setRotationTimes
Sets a list of times at which file rotation should be triggered; times should be provided as Strings that can be parsed byDurationthat each specify an offset from midnight.For example the list of [10 milliseconds, 20 milliseconds, 30 milliseconds] will cause a file rotation to happen 10 milliseconds, 20 milliseconds and 30 milliseconds after midnight.
- Parameters:
rotationTimes- The list of durations after midnight that rotation should happen.
-
buildTimeStampFileNamingPolicy
Builds aTimeStampFileNamingPolicyinstance from configuration options.- Parameters:
file- Initial log file- Returns:
TimeStampFileNamingPolicyinstance
-
buildRotationPolicies
BuildsRotationPolicyinstances from configuration options.- Returns:
RotationPolicyinstances
-