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 String
DEFAULT_ROTATION_FILE_SUFFIX
The default file rotation suffix format.static long
NO_MAX_FILE_SIZE
The 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()
BuildsRotationPolicy
instances from configuration options.TimeStampFileNamingPolicy
buildTimeStampFileNamingPolicy(File file)
Builds aTimeStampFileNamingPolicy
instance from configuration options.long
getMaxFileSize()
Gets the maximum file size of an audit log file in bytes.String
getRotationFilePrefix()
Gets the prefix to add to a log file on rotation.String
getRotationFileSuffix()
Gets the suffix to add to a log file on rotation.String
getRotationInterval()
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 byDuration
that each specify an offset from midnight.boolean
isRotationEnabled()
Gets log rotation enabled state.void
setMaxFileSize(long maxFileSize)
Sets the maximum file size of an audit log file in bytes.void
setRotationEnabled(boolean rotationEnabled)
Sets log rotation enabled state.void
setRotationFilePrefix(String rotationFilePrefix)
Sets the prefix to add to a log file on rotation.void
setRotationFileSuffix(String rotationFileSuffix)
Sets the suffix to add to a log file on rotation.void
setRotationInterval(String rotationInterval)
Sets the interval to trigger a file rotation.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 byDuration
that 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 disabled
A 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 disabled
A 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 byDuration
that 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 byDuration
that 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 aTimeStampFileNamingPolicy
instance from configuration options.- Parameters:
file
- Initial log file- Returns:
TimeStampFileNamingPolicy
instance
-
buildRotationPolicies
public List<RotationPolicy> buildRotationPolicies()
BuildsRotationPolicy
instances from configuration options.- Returns:
RotationPolicy
instances
-
-