Package org.wildfly.security.audit
Class PeriodicRotatingFileAuditEndpoint
- java.lang.Object
-
- org.wildfly.security.audit.FileAuditEndpoint
-
- org.wildfly.security.audit.PeriodicRotatingFileAuditEndpoint
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.wildfly.common.function.ExceptionBiConsumer<EventPriority,String,IOException>,AuditEndpoint
public class PeriodicRotatingFileAuditEndpoint extends FileAuditEndpoint
An audit endpoint which rotates the log at a preset time interval. Depending on set suffix, moves old log records into files tagged by timestamp.Based on
PeriodicSizeRotatingFileHandler.- Author:
- Jan Kalina, James R. Perkins, Yeray Borges
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPeriodicRotatingFileAuditEndpoint.BuilderA builder for periodic rotating file audit endpoints.(package private) static classPeriodicRotatingFileAuditEndpoint.PeriodPossible period values.
-
Field Summary
Fields Modifier and Type Field Description private DateTimeFormatterformatprivate longnextRolloverprivate StringnextSuffixprivate PeriodicRotatingFileAuditEndpoint.Periodperiodprivate ZoneIdtimeZone-
Fields inherited from class org.wildfly.security.audit.FileAuditEndpoint
clock
-
-
Constructor Summary
Constructors Constructor Description PeriodicRotatingFileAuditEndpoint(PeriodicRotatingFileAuditEndpoint.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PeriodicRotatingFileAuditEndpoint.Builderbuilder()Obtain a newPeriodicRotatingFileAuditEndpoint.Buildercapable of building aPeriodicRotatingFileAuditEndpoint.private voidcalcNextRollover(long fromTime)For given time and period obtains time when should be new log file startedprivate static <T extends Comparable<? super T>>
Tmin(T a, T b)protected voidpreWrite(Instant instant)Checks whether time-based log rotation should be done and if so, it moves current log file into time-tagged file and exchange target file to continue logging into new, non-time-tagged file.-
Methods inherited from class org.wildfly.security.audit.FileAuditEndpoint
accept, close, closeStreams, getFile, setFile, write
-
-
-
-
Field Detail
-
format
private final DateTimeFormatter format
-
period
private final PeriodicRotatingFileAuditEndpoint.Period period
-
timeZone
private final ZoneId timeZone
-
nextRollover
private long nextRollover
-
nextSuffix
private String nextSuffix
-
-
Constructor Detail
-
PeriodicRotatingFileAuditEndpoint
PeriodicRotatingFileAuditEndpoint(PeriodicRotatingFileAuditEndpoint.Builder builder) throws IOException
- Throws:
IOException
-
-
Method Detail
-
preWrite
protected void preWrite(Instant instant)
Checks whether time-based log rotation should be done and if so, it moves current log file into time-tagged file and exchange target file to continue logging into new, non-time-tagged file.- Overrides:
preWritein classFileAuditEndpoint- Parameters:
instant- time of the message acceptance
-
calcNextRollover
private void calcNextRollover(long fromTime)
For given time and period obtains time when should be new log file started
-
builder
public static PeriodicRotatingFileAuditEndpoint.Builder builder()
Obtain a newPeriodicRotatingFileAuditEndpoint.Buildercapable of building aPeriodicRotatingFileAuditEndpoint.- Returns:
- a new
PeriodicRotatingFileAuditEndpoint.Buildercapable of building aPeriodicRotatingFileAuditEndpoint.
-
min
private static <T extends Comparable<? super T>> T min(T a, T b)
-
-