Package org.opends.server.loggers
Class TextAuditLogPublisher
- java.lang.Object
-
- org.opends.server.loggers.AccessLogPublisher<T>
-
- org.opends.server.loggers.TextAuditLogPublisher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationChangeListener<FileBasedAuditLogPublisherCfg>
,LogPublisher<FileBasedAuditLogPublisherCfg>
public final class TextAuditLogPublisher extends AccessLogPublisher<T> implements ConfigurationChangeListener<FileBasedAuditLogPublisherCfg>
This class provides the implementation of the audit logger used by the directory server.
-
-
Constructor Summary
Constructors Constructor Description TextAuditLogPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(FileBasedAuditLogPublisherCfg config)
Applies the configuration changes to this change listener.protected void
buildFilters()
For startup access logger.void
close()
Close this publisher.protected void
close0()
Release any resources owned by the sub-implementation.Dn
getDN()
Gets the DN of the configuration entry for this log publisher.protected String
getTransactionId(RequestContext context)
protected void
initializeFilters(T config)
Initializes the filter configuration.void
initializeLogPublisher(FileBasedAuditLogPublisherCfg cfg, ServerContext serverContext)
Initializes this publisher provider based on the information in the provided debug publisher configuration.boolean
isConfigurationAcceptable(FileBasedAuditLogPublisherCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this log publisher.boolean
isConfigurationChangeAcceptable(FileBasedAuditLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.protected boolean
isConnectLoggable(ClientConnection c)
Returnstrue
if the provided client connect should be logged.protected boolean
isDisconnectLoggable(ClientConnection c)
Returnstrue
if the provided client disconnect should be logged.protected boolean
isFilterConfigurationAcceptable(T config, List<LocalizableMessage> unacceptableReasons)
Perform any initialization required by the sub-implementation.protected boolean
isRequestLoggable(RequestContext context, Request request)
Returnstrue
if the provided request should be logged.protected boolean
isResponseLoggable(RequestContext context, Request request, Response response)
Returnstrue
if the provided response should be logged.void
logAddResult(RequestContext context, AddRequest request, Result result)
Writes a message to the access logger with information about the add result.void
logDeleteResult(RequestContext context, DeleteRequest request, Result result)
Writes a message to the access logger with information about the delete result.void
logModifyDnResult(RequestContext context, ModifyDnRequest request, Result result)
Writes a message to the access logger with information about the modifyDN result.void
logModifyResult(RequestContext context, ModifyRequest request, Result result)
Writes a message to the access logger with information about the modify result.-
Methods inherited from class org.opends.server.loggers.AccessLogPublisher
logAbandonRequest, logAbandonResult, logAddRequest, logBindRequest, logBindResult, logCompareRequest, logCompareResult, logConnect, logDeleteRequest, logDisconnect, logExtendedRequest, logExtendedResult, logInvalidRequest, logInvalidResult, logModifyDnRequest, logModifyRequest, logSearchRequest, logSearchResult, logUnbind
-
-
-
-
Method Detail
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(FileBasedAuditLogPublisherCfg config)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<FileBasedAuditLogPublisherCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
close0
protected void close0()
Release any resources owned by the sub-implementation.
-
initializeLogPublisher
public void initializeLogPublisher(FileBasedAuditLogPublisherCfg cfg, ServerContext serverContext) throws ConfigException, InitializationException
Description copied from interface:LogPublisher
Initializes this publisher provider based on the information in the provided debug publisher configuration.- Specified by:
initializeLogPublisher
in interfaceLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
cfg
- The publisher configuration that contains the information to use to initialize this publisher.serverContext
- The server context.- Throws:
ConfigException
- If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.InitializationException
- If a problem occurs during initialization that is not related to the server configuration.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(FileBasedAuditLogPublisherCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:LogPublisher
Indicates whether the provided configuration is acceptable for this log publisher. It should be possible to call this method on an uninitialized log publisher instance in order to determine whether the log publisher would be able to use the provided configuration.- Specified by:
isConfigurationAcceptable
in interfaceLogPublisher<FileBasedAuditLogPublisherCfg>
- Overrides:
isConfigurationAcceptable
in classAccessLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
configuration
- The log publisher configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
true
if the provided configuration is acceptable for this log publisher, orfalse
if not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FileBasedAuditLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<FileBasedAuditLogPublisherCfg>
- Parameters:
config
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
logAddResult
public void logAddResult(RequestContext context, AddRequest request, Result result)
Description copied from class:AccessLogPublisher
Writes a message to the access logger with information about the add result.The default implementation is to not log anything.
- Overrides:
logAddResult
in classAccessLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
context
- the logging context for the requestrequest
- the original add requestresult
- the result to log
-
logDeleteResult
public void logDeleteResult(RequestContext context, DeleteRequest request, Result result)
Description copied from class:AccessLogPublisher
Writes a message to the access logger with information about the delete result.The default implementation is to not log anything.
- Overrides:
logDeleteResult
in classAccessLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
context
- the logging context for the requestrequest
- the original delete requestresult
- the result to log
-
logModifyResult
public void logModifyResult(RequestContext context, ModifyRequest request, Result result)
Description copied from class:AccessLogPublisher
Writes a message to the access logger with information about the modify result.The default implementation is to not log anything.
- Overrides:
logModifyResult
in classAccessLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
context
- the logging context for the requestrequest
- the original modify requestresult
- the result to log
-
logModifyDnResult
public void logModifyDnResult(RequestContext context, ModifyDnRequest request, Result result)
Description copied from class:AccessLogPublisher
Writes a message to the access logger with information about the modifyDN result.The default implementation is to not log anything.
- Overrides:
logModifyDnResult
in classAccessLogPublisher<FileBasedAuditLogPublisherCfg>
- Parameters:
context
- the logging context for the requestrequest
- the original modifyDN requestresult
- the result to log
-
getTransactionId
protected String getTransactionId(RequestContext context)
-
close
public final void close()
Description copied from interface:LogPublisher
Close this publisher.
-
getDN
public final Dn getDN()
Description copied from interface:LogPublisher
Gets the DN of the configuration entry for this log publisher.- Returns:
- The configuration entry DN.
-
initializeFilters
protected final void initializeFilters(T config) throws ConfigException
Initializes the filter configuration. This method must be called by sub-classes during initialization.- Parameters:
config
- The access publisher configuration that contains the information to use to initialize this access publisher.- Throws:
ConfigException
- If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.
-
isConnectLoggable
protected final boolean isConnectLoggable(ClientConnection c)
Returnstrue
if the provided client connect should be logged.- Parameters:
c
- The client connection.- Returns:
true
if the provided client connect should be logged.
-
isDisconnectLoggable
protected final boolean isDisconnectLoggable(ClientConnection c)
Returnstrue
if the provided client disconnect should be logged.- Parameters:
c
- The client connection.- Returns:
true
if the provided client disconnect should be logged.
-
isFilterConfigurationAcceptable
protected final boolean isFilterConfigurationAcceptable(T config, List<LocalizableMessage> unacceptableReasons)
Perform any initialization required by the sub-implementation.- Parameters:
config
- The access publisher configuration that contains the information to use to initialize this access publisher.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
true
if the provided configuration is acceptable for this access log publisher, orfalse
if not.
-
isRequestLoggable
protected final boolean isRequestLoggable(RequestContext context, Request request)
Returnstrue
if the provided request should be logged.- Parameters:
context
- the log contextrequest
- the request to log- Returns:
true
if the provided request should be logged.
-
isResponseLoggable
protected final boolean isResponseLoggable(RequestContext context, Request request, Response response)
Returnstrue
if the provided response should be logged.- Parameters:
context
- the log contextrequest
- the request to which the response correspondsresponse
- the response to log- Returns:
true
if the provided response should be logged.
-
buildFilters
protected void buildFilters()
For startup access logger.
-
-