Package org.jboss.as.controller.audit
Class ManagedAuditLoggerImpl
- java.lang.Object
-
- org.jboss.as.controller.audit.ManagedAuditLoggerImpl
-
- All Implemented Interfaces:
AuditLogger,ManagedAuditLogger,ManagedAuditLogger.AuditLogHandlerUpdater
public class ManagedAuditLoggerImpl extends Object implements ManagedAuditLogger, ManagedAuditLogger.AuditLogHandlerUpdater
Audit logger wrapper- Author:
- Brian Stansberry (c) 2012 Red Hat Inc., Kabir Khan
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.controller.audit.AuditLogger
AuditLogger.Status
-
Nested classes/interfaces inherited from interface org.jboss.as.controller.audit.ManagedAuditLogger
ManagedAuditLogger.AuditLogHandlerUpdater
-
-
Field Summary
-
Fields inherited from interface org.jboss.as.controller.audit.AuditLogger
NO_OP_LOGGER
-
-
Constructor Summary
Constructors Constructor Description ManagedAuditLoggerImpl(String asVersion, boolean server)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFormatter(AuditLogItemFormatter formatter)Add a formattervoidaddHandler(org.jboss.as.controller.audit.AuditLogHandler handler)Adds a new handler, this handler will be used when logging the current operationvoidaddHandlerReference(PathAddress referenceAddress)Add a handler reference.voidapplyChanges()Apply the changes.voidbootDone()Callback for the controller to call when the controller has been bootedManagedAuditLoggerImplcreateNewConfiguration(boolean manualCommit)Create another audit logger configuration, e.g.booleangetHandlerDisabledDueToFailure(String name)Get whether a handler was disabled due to failuresintgetHandlerFailureCount(String name)Get the current failure count of a handlerJsonAuditLogItemFormattergetJsonFormatter(String name)Gets a formatter by its nameAuditLogger.StatusgetLoggerStatus()Gets the status of the audit loggerManagedAuditLogger.AuditLogHandlerUpdatergetUpdater()Gets the handler updater used to schedule updates to the handlersbooleanisLogBoot()Get whether this audit logger logs operations on bootbooleanisLogReadOnly()Get whether this audit logger logs read-only operationsList<org.jboss.dmr.ModelNode>listLastEntries(String name)Gets the last log entriesvoidlog(boolean readOnly, OperationContext.ResultAction resultAction, String userId, String domainUUID, AccessMechanism accessMechanism, InetAddress remoteAddress, Resource resultantModel, List<org.jboss.dmr.ModelNode> operations)voidlogJmxMethodAccess(boolean readOnly, String userId, String domainUUID, AccessMechanism accessMechanism, InetAddress remoteAddress, String methodName, String[] methodSignature, Object[] methodParams, Throwable error)voidrecycleHandler(String name)Recycles a handler.voidremoveFormatter(String name)Remove a formattervoidremoveHandler(String name)Remove a handler.voidremoveHandlerReference(PathAddress referenceAddress)Add a handler reference.voidrollbackChanges()Roll back changes made as part of the current operation.voidsetLogBoot(boolean logBoot)Set whether to log operations on bootvoidsetLoggerStatus(AuditLogger.Status newStatus)Sets the status of the audit loggervoidsetLogReadOnly(boolean logReadOnly)Set whether to log read-only operationsvoidstartBoot()Callback for the controller to call before the controller is bootedvoidupdateHandler(org.jboss.as.controller.audit.AuditLogHandler handler)Update a handler.voidupdateHandlerFormatter(String name, String formatterName)Update the handler formatter.voidupdateHandlerMaxFailureCount(String name, int count)Update the handler max failure count.voidupdateInMemoryHandlerMaxHistory(String name, int maxHistory)Update the handler history size.voidupdateSyslogHandlerAppName(String name, String appName)Update the handler app-name.voidupdateSyslogHandlerFacility(String name, SyslogAuditLogHandler.Facility facility)Update the syslog handler facility.voidupdateSyslogHandlerReconnectTimeout(String name, int reconnectTimeout)Update the handler reconnect timeout.
-
-
-
Constructor Detail
-
ManagedAuditLoggerImpl
public ManagedAuditLoggerImpl(String asVersion, boolean server)
-
-
Method Detail
-
log
public void log(boolean readOnly, OperationContext.ResultAction resultAction, String userId, String domainUUID, AccessMechanism accessMechanism, InetAddress remoteAddress, Resource resultantModel, List<org.jboss.dmr.ModelNode> operations)- Specified by:
login interfaceAuditLogger
-
logJmxMethodAccess
public void logJmxMethodAccess(boolean readOnly, String userId, String domainUUID, AccessMechanism accessMechanism, InetAddress remoteAddress, String methodName, String[] methodSignature, Object[] methodParams, Throwable error)- Specified by:
logJmxMethodAccessin interfaceAuditLogger
-
createNewConfiguration
public ManagedAuditLoggerImpl createNewConfiguration(boolean manualCommit)
Description copied from interface:ManagedAuditLoggerCreate another audit logger configuration, e.g. for JMX which has its own global config of the audit logger- Specified by:
createNewConfigurationin interfaceManagedAuditLogger- Parameters:
manualCommit- iftruethe caller is responsible for applying the changes themselves, iffalsethe changes will be committed after the next log records has been written- Returns:
- the new configuration
-
isLogReadOnly
public boolean isLogReadOnly()
Description copied from interface:ManagedAuditLoggerGet whether this audit logger logs read-only operations- Specified by:
isLogReadOnlyin interfaceManagedAuditLogger- Returns:
- whether this audit logger logs read-only operations
-
setLogReadOnly
public void setLogReadOnly(boolean logReadOnly)
Description copied from interface:ManagedAuditLoggerSet whether to log read-only operations- Specified by:
setLogReadOnlyin interfaceManagedAuditLogger- Parameters:
logReadOnly- wheter to log read-only operations
-
isLogBoot
public boolean isLogBoot()
Description copied from interface:ManagedAuditLoggerGet whether this audit logger logs operations on boot- Specified by:
isLogBootin interfaceManagedAuditLogger- Returns:
- whether this audit logger logs operations on boot
-
setLogBoot
public void setLogBoot(boolean logBoot)
Description copied from interface:ManagedAuditLoggerSet whether to log operations on boot- Specified by:
setLogBootin interfaceManagedAuditLogger- Parameters:
logBoot- whether to log operations on boot
-
getLoggerStatus
public AuditLogger.Status getLoggerStatus()
Description copied from interface:ManagedAuditLoggerGets the status of the audit logger- Specified by:
getLoggerStatusin interfaceManagedAuditLogger- Returns:
- the status
-
recycleHandler
public void recycleHandler(String name)
Description copied from interface:ManagedAuditLoggerRecycles a handler. This stops it, and resets the failure count so that the next time it is used it will reinitialize.- Specified by:
recycleHandlerin interfaceManagedAuditLogger- Parameters:
name- the name of the handler
-
setLoggerStatus
public void setLoggerStatus(AuditLogger.Status newStatus)
Description copied from interface:ManagedAuditLoggerSets the status of the audit logger- Specified by:
setLoggerStatusin interfaceManagedAuditLogger- Parameters:
newStatus- the status
-
getUpdater
public ManagedAuditLogger.AuditLogHandlerUpdater getUpdater()
Description copied from interface:ManagedAuditLoggerGets the handler updater used to schedule updates to the handlers- Specified by:
getUpdaterin interfaceManagedAuditLogger- Returns:
- the handler updater
-
addHandler
public void addHandler(org.jboss.as.controller.audit.AuditLogHandler handler)
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterAdds a new handler, this handler will be used when logging the current operation- Specified by:
addHandlerin interfaceManagedAuditLogger.AuditLogHandlerUpdater- Parameters:
handler- the handler
-
updateHandler
public void updateHandler(org.jboss.as.controller.audit.AuditLogHandler handler)
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterUpdate a handler. The update will only take place if the handler has actually been changed. The changes to the handler will only take effect after the current operation has been logged.- Specified by:
updateHandlerin interfaceManagedAuditLogger.AuditLogHandlerUpdater- Parameters:
handler- the updated handler
-
removeHandler
public void removeHandler(String name)
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterRemove a handler. The removal will only take effect after the current operation has been logged.- Specified by:
removeHandlerin interfaceManagedAuditLogger.AuditLogHandlerUpdater- Parameters:
name- the name of the handler to be removed
-
addHandlerReference
public void addHandlerReference(PathAddress referenceAddress)
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterAdd a handler reference. This reference will take effect when logging the current operation- Specified by:
addHandlerReferencein interfaceManagedAuditLogger.AuditLogHandlerUpdater- Parameters:
referenceAddress- the address of the handler reference (the value of the last element is the name of the referenced handler)
-
removeHandlerReference
public void removeHandlerReference(PathAddress referenceAddress)
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterAdd a handler reference. This reference removal will only take effect after the current operation has been logged.- Specified by:
removeHandlerReferencein interfaceManagedAuditLogger.AuditLogHandlerUpdater- Parameters:
referenceAddress- the address of the handler reference (the value of the last element is the name of the referenced handler)
-
rollbackChanges
public void rollbackChanges()
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterRoll back changes made as part of the current operation.- Specified by:
rollbackChangesin interfaceManagedAuditLogger.AuditLogHandlerUpdater
-
applyChanges
public void applyChanges()
Description copied from interface:ManagedAuditLogger.AuditLogHandlerUpdaterApply the changes. This is only allowed for update tasks for new audit log configurations which specify that manual commit should be used.- Specified by:
applyChangesin interfaceManagedAuditLogger.AuditLogHandlerUpdater
-
removeFormatter
public void removeFormatter(String name)
Description copied from interface:ManagedAuditLoggerRemove a formatter- Specified by:
removeFormatterin interfaceManagedAuditLogger- Parameters:
name- the formatter name
-
addFormatter
public void addFormatter(AuditLogItemFormatter formatter)
Description copied from interface:ManagedAuditLoggerAdd a formatter- Specified by:
addFormatterin interfaceManagedAuditLogger- Parameters:
formatter- the formatter
-
updateHandlerFormatter
public void updateHandlerFormatter(String name, String formatterName)
Description copied from interface:ManagedAuditLoggerUpdate the handler formatter. This will take effect immediately.- Specified by:
updateHandlerFormatterin interfaceManagedAuditLogger- Parameters:
name- the name of the handlerformatterName- the name of the formatter
-
updateHandlerMaxFailureCount
public void updateHandlerMaxFailureCount(String name, int count)
Description copied from interface:ManagedAuditLoggerUpdate the handler max failure count. This will take effect immediately- Specified by:
updateHandlerMaxFailureCountin interfaceManagedAuditLogger- Parameters:
name- the name of the handlercount- the max failure count
-
getHandlerFailureCount
public int getHandlerFailureCount(String name)
Description copied from interface:ManagedAuditLoggerGet the current failure count of a handler- Specified by:
getHandlerFailureCountin interfaceManagedAuditLogger- Parameters:
name- the name of the handler- Returns:
- the failure count
-
updateSyslogHandlerFacility
public void updateSyslogHandlerFacility(String name, SyslogAuditLogHandler.Facility facility)
Description copied from interface:ManagedAuditLoggerUpdate the syslog handler facility. This will take effect immediately.- Specified by:
updateSyslogHandlerFacilityin interfaceManagedAuditLogger- Parameters:
name- the name of the syslog handlerfacility- the facility
-
updateSyslogHandlerAppName
public void updateSyslogHandlerAppName(String name, String appName)
Description copied from interface:ManagedAuditLoggerUpdate the handler app-name. This will take effect immediately- Specified by:
updateSyslogHandlerAppNamein interfaceManagedAuditLogger- Parameters:
name- the name of the handlerappName- the app name
-
updateSyslogHandlerReconnectTimeout
public void updateSyslogHandlerReconnectTimeout(String name, int reconnectTimeout)
Description copied from interface:ManagedAuditLoggerUpdate the handler reconnect timeout. This will take effect immediately- Specified by:
updateSyslogHandlerReconnectTimeoutin interfaceManagedAuditLogger- Parameters:
name- the name of the handlerreconnectTimeout- the app name
-
getHandlerDisabledDueToFailure
public boolean getHandlerDisabledDueToFailure(String name)
Description copied from interface:ManagedAuditLoggerGet whether a handler was disabled due to failures- Specified by:
getHandlerDisabledDueToFailurein interfaceManagedAuditLogger- Parameters:
name- the name of the handler- Returns:
- whether it is disabled
-
getJsonFormatter
public JsonAuditLogItemFormatter getJsonFormatter(String name)
Description copied from interface:ManagedAuditLoggerGets a formatter by its name- Specified by:
getJsonFormatterin interfaceManagedAuditLogger- Parameters:
name- the name of the formatter- Returns:
- the formatter
-
listLastEntries
public List<org.jboss.dmr.ModelNode> listLastEntries(String name)
Description copied from interface:ManagedAuditLoggerGets the last log entries- Specified by:
listLastEntriesin interfaceManagedAuditLogger- Parameters:
name- the name of the handler- Returns:
- the last log entries of the handler
-
updateInMemoryHandlerMaxHistory
public void updateInMemoryHandlerMaxHistory(String name, int maxHistory)
Description copied from interface:ManagedAuditLoggerUpdate the handler history size.- Specified by:
updateInMemoryHandlerMaxHistoryin interfaceManagedAuditLogger- Parameters:
name- the name of the handlermaxHistory- the history size of the handler
-
bootDone
public void bootDone()
Description copied from interface:ManagedAuditLoggerCallback for the controller to call when the controller has been booted- Specified by:
bootDonein interfaceManagedAuditLogger
-
startBoot
public void startBoot()
Description copied from interface:ManagedAuditLoggerCallback for the controller to call before the controller is booted- Specified by:
startBootin interfaceManagedAuditLogger
-
-