Class FileBasedEventHandlerConfiguration.FileRotation
- java.lang.Object
-
- org.forgerock.audit.events.handlers.FileBasedEventHandlerConfiguration.FileRotation
-
- Enclosing class:
- FileBasedEventHandlerConfiguration
public static class FileBasedEventHandlerConfiguration.FileRotation extends Object
Groups the file rotation config parameters.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ROTATION_FILE_SUFFIXThe default file rotation suffix format.static longNO_MAX_FILE_SIZEThe file size value to use when no maximum is set.
-
Constructor Summary
Constructors Constructor Description FileRotation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<RotationPolicy>buildRotationPolicies()BuildsRotationPolicyinstances from configuration options.TimeStampFileNamingPolicybuildTimeStampFileNamingPolicy(File file)Builds aTimeStampFileNamingPolicyinstance from configuration options.longgetMaxFileSize()Gets the maximum file size of an audit log file in bytes.StringgetRotationFilePrefix()Gets the prefix to add to a log file on rotation.StringgetRotationFileSuffix()Gets the suffix to add to a log file on rotation.StringgetRotationInterval()Gets the interval to trigger a file rotation.List<String>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.booleanisRotationEnabled()Gets 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 Detail
-
NO_MAX_FILE_SIZE
public static final long NO_MAX_FILE_SIZE
The file size value to use when no maximum is set.- See Also:
- Constant Field Values
-
DEFAULT_ROTATION_FILE_SUFFIX
public static final String DEFAULT_ROTATION_FILE_SUFFIX
The default file rotation suffix format.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public String 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
public void setRotationFilePrefix(String rotationFilePrefix)
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
public String 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
public void setRotationFileSuffix(String rotationFileSuffix)
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
public String 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
public void setRotationInterval(String rotationInterval)
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
public List<String> 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
public void setRotationTimes(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.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
public TimeStampFileNamingPolicy buildTimeStampFileNamingPolicy(File file)
Builds aTimeStampFileNamingPolicyinstance from configuration options.- Parameters:
file- Initial log file- Returns:
TimeStampFileNamingPolicyinstance
-
buildRotationPolicies
public List<RotationPolicy> buildRotationPolicies()
BuildsRotationPolicyinstances from configuration options.- Returns:
RotationPolicyinstances
-
-