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.StatusNested 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormatter(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.voidApply the changes.voidbootDone()Callback for the controller to call when the controller has been bootedcreateNewConfiguration(boolean manualCommit) Create another audit logger configuration, e.g. for JMX which has its own global config of the audit loggerbooleanGet whether a handler was disabled due to failuresintgetHandlerFailureCount(String name) Get the current failure count of a handlergetJsonFormatter(String name) Gets a formatter by its nameGets the status of the audit loggerGets the handler updater used to schedule updates to the handlersbooleanGet whether this audit logger logs operations on bootbooleanGet 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.voidRoll 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 operationsvoidCallback 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 Details
-
ManagedAuditLoggerImpl
-
-
Method Details
-
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
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
Description copied from interface:ManagedAuditLoggerGets the status of the audit logger- Specified by:
getLoggerStatusin interfaceManagedAuditLogger- Returns:
- the status
-
recycleHandler
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
Description copied from interface:ManagedAuditLoggerSets the status of the audit logger- Specified by:
setLoggerStatusin interfaceManagedAuditLogger- Parameters:
newStatus- the status
-
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
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
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
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
Description copied from interface:ManagedAuditLoggerRemove a formatter- Specified by:
removeFormatterin interfaceManagedAuditLogger- Parameters:
name- the formatter name
-
addFormatter
Description copied from interface:ManagedAuditLoggerAdd a formatter- Specified by:
addFormatterin interfaceManagedAuditLogger- Parameters:
formatter- the formatter
-
updateHandlerFormatter
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
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
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
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
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
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
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
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
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
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
-