Package org.wildfly.security.audit
Class SizeRotatingFileAuditEndpoint.Builder
- java.lang.Object
-
- org.wildfly.security.audit.FileAuditEndpoint.Builder
-
- org.wildfly.security.audit.SizeRotatingFileAuditEndpoint.Builder
-
- Enclosing class:
- SizeRotatingFileAuditEndpoint
public static class SizeRotatingFileAuditEndpoint.Builder extends FileAuditEndpoint.Builder
A builder for size rotating file audit endpoints.
-
-
Field Summary
Fields Modifier and Type Field Description private intmaxBackupIndexprivate booleanrotateOnBootprivate longrotateSizeprivate Stringsuffix(package private) ZoneIdtimeZone
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuditEndpointbuild()Construct a new instance.SizeRotatingFileAuditEndpoint.BuildersetMaxBackupIndex(int maxBackupIndex)Set the maximum number of files to backup.SizeRotatingFileAuditEndpoint.BuildersetRotateOnBoot(boolean rotateOnBoot)Set to a value oftrueif the file should be rotated before the a new file is set.SizeRotatingFileAuditEndpoint.BuildersetRotateSize(long rotateSize)Set the log file size the file should rotate at.SizeRotatingFileAuditEndpoint.BuildersetSuffix(String suffix)Sets the suffix to be appended to the file name during the file rotation.SizeRotatingFileAuditEndpoint.BuildersetTimeZone(ZoneId timeZone)Set the configured time zone for this handler.-
Methods inherited from class org.wildfly.security.audit.FileAuditEndpoint.Builder
setClock, setDateTimeFormatterSupplier, setFlushOnAccept, setLocation, setSyncOnAccept
-
-
-
-
Method Detail
-
setRotateSize
public SizeRotatingFileAuditEndpoint.Builder setRotateSize(long rotateSize)
Set the log file size the file should rotate at.- Parameters:
rotateSize- the size the file should rotate at- Returns:
- this builder.
-
setSuffix
public SizeRotatingFileAuditEndpoint.Builder setSuffix(String suffix)
Sets the suffix to be appended to the file name during the file rotation. The suffix does not play a role in determining when the file should be rotated. The suffix must be a string understood by theDateTimeFormatter. Note: Files will be rotated for the same suffix until reach the maximum backup index configured bysetMaxBackupIndex(int). If the suffix is resolved to a new value, any files rotated with a different suffix will not be deleted. For example if the suffix is .yyyy-DD-mm, the maximum size was reached 20 times on the same day and the maxBackupIndex was set to 10, then there will only be 10 files kept. What will not be purged is files from a previous day.- Parameters:
suffix- the suffix to place after the filename when the file is rotated
-
setMaxBackupIndex
public SizeRotatingFileAuditEndpoint.Builder setMaxBackupIndex(int maxBackupIndex)
Set the maximum number of files to backup.- Parameters:
maxBackupIndex- the maximum number of files to backup- Returns:
- this builder.
-
setRotateOnBoot
public SizeRotatingFileAuditEndpoint.Builder setRotateOnBoot(boolean rotateOnBoot)
Set to a value oftrueif the file should be rotated before the a new file is set. The rotation only happens if the file names are the same and the file has alengthgreater than 0.- Parameters:
rotateOnBoot-trueto rotate on boot, otherwisefalse- Returns:
- this builder.
-
setTimeZone
public SizeRotatingFileAuditEndpoint.Builder setTimeZone(ZoneId timeZone)
Set the configured time zone for this handler.- Parameters:
timeZone- the configured time zone- Returns:
- this builder.
-
build
public AuditEndpoint build() throws IOException
Construct a new instance.- Overrides:
buildin classFileAuditEndpoint.Builder- Returns:
- the built audit endpoint.
- Throws:
IOException- if an I/O error occurs.
-
-