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 Details

    • 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:
    • DEFAULT_ROTATION_FILE_SUFFIX

      public static final String 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

      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 in SimpleDateFormat. 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 in SimpleDateFormat. 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 a Duration.

      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 a Duration.

      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 a Duration, 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 by Duration 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 by Duration 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 a TimeStampFileNamingPolicy instance from configuration options.
      Parameters:
      file - Initial log file
      Returns:
      TimeStampFileNamingPolicy instance
    • buildRotationPolicies

      public List<RotationPolicy> buildRotationPolicies()
      Builds RotationPolicy instances from configuration options.
      Returns:
      RotationPolicy instances