Package org.wildfly.security.audit
Class SyslogAuditEndpoint
- java.lang.Object
-
- org.wildfly.security.audit.SyslogAuditEndpoint
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.wildfly.common.function.ExceptionBiConsumer<EventPriority,String,IOException>
,AuditEndpoint
public class SyslogAuditEndpoint extends Object implements AuditEndpoint
An audit endpoint that logs to syslog server.- Author:
- Darran Lofthouse
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SyslogAuditEndpoint.Builder
A builder for syslog audit endpoint.private class
SyslogAuditEndpoint.TransportErrorManager
-
Field Summary
Fields Modifier and Type Field Description private boolean
accepting
private int
currentReconnectAttempts
private SyslogAuditEndpoint.TransportErrorManager
errorManager
private static int
INFINITE_RECONNECT_ATTEMPTS_OVERFLOW_NUMBER
private int
maxReconnectAttempts
private org.jboss.logmanager.handlers.SyslogHandler.Protocol
protocol
private org.jboss.logmanager.handlers.SyslogHandler
syslogHandler
private org.jboss.logmanager.handlers.TcpOutputStream
tcpOutputStream
-
Constructor Summary
Constructors Constructor Description SyslogAuditEndpoint(SyslogAuditEndpoint.Builder builder)
Creates a new audit endpoint that logs to syslog server.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(EventPriority priority, String message)
static SyslogAuditEndpoint.Builder
builder()
Obtain a newSyslogAuditEndpoint.Builder
capable of building aSyslogAuditEndpoint
.private void
checkAttempts()
void
close()
Close the endpoint and stop handling further events immediately.int
getAttempts()
Gets the current amount of reconnect attempts, with -1 signifying that the value for infinite reconnect attempts case has overflowed the maximum allowed amountprivate static Level
toLevel(EventPriority eventPriority)
private void
tryPublish(EventPriority priority, String message)
-
-
-
Field Detail
-
accepting
private volatile boolean accepting
-
syslogHandler
private final org.jboss.logmanager.handlers.SyslogHandler syslogHandler
-
errorManager
private final SyslogAuditEndpoint.TransportErrorManager errorManager
-
protocol
private final org.jboss.logmanager.handlers.SyslogHandler.Protocol protocol
-
maxReconnectAttempts
private final int maxReconnectAttempts
-
tcpOutputStream
private final org.jboss.logmanager.handlers.TcpOutputStream tcpOutputStream
-
INFINITE_RECONNECT_ATTEMPTS_OVERFLOW_NUMBER
private static final int INFINITE_RECONNECT_ATTEMPTS_OVERFLOW_NUMBER
-
currentReconnectAttempts
private int currentReconnectAttempts
-
-
Constructor Detail
-
SyslogAuditEndpoint
SyslogAuditEndpoint(SyslogAuditEndpoint.Builder builder) throws IOException
Creates a new audit endpoint that logs to syslog server.- Throws:
IOException
-
-
Method Detail
-
accept
public void accept(EventPriority priority, String message) throws IOException
- Specified by:
accept
in interfaceorg.wildfly.common.function.ExceptionBiConsumer<EventPriority,String,IOException>
- Throws:
IOException
-
checkAttempts
private void checkAttempts() throws IOException
- Throws:
IOException
-
getAttempts
public int getAttempts()
Gets the current amount of reconnect attempts, with -1 signifying that the value for infinite reconnect attempts case has overflowed the maximum allowed amount- Returns:
- The current reconnect attempts, or -1 if the maximum tracked value for infinite attempts has overflowed
-
toLevel
private static Level toLevel(EventPriority eventPriority)
-
close
public void close() throws IOException
Description copied from interface:AuditEndpoint
Close the endpoint and stop handling further events immediately.- Specified by:
close
in interfaceAuditEndpoint
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if an error occurs closing the endpoint.
-
builder
public static SyslogAuditEndpoint.Builder builder()
Obtain a newSyslogAuditEndpoint.Builder
capable of building aSyslogAuditEndpoint
.- Returns:
- a new
SyslogAuditEndpoint.Builder
capable of building aSyslogAuditEndpoint
.
-
tryPublish
private void tryPublish(EventPriority priority, String message) throws IOException
- Throws:
IOException
-
-