Class SplunkAuditEventHandler
- All Implemented Interfaces:
AuditEventHandler
,BatchConsumer
-
Field Summary
Fields inherited from class org.forgerock.audit.events.handlers.AuditEventHandlerBase
eventTopicsMetaData
-
Constructor Summary
ConstructorDescriptionSplunkAuditEventHandler
(SplunkAuditEventHandlerConfiguration configuration, EventTopicsMetaData eventTopicsMetaData, BatchPublisherFactory publisherFactory, org.forgerock.http.Client client) Constructs a new Splunk audit event handler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToBatch
(String topic, JsonValue event, StringBuilder payload) Adds an audit event to a batch payload.publishBatch
(String payload) Publishes the batch payload.publishEvent
(org.forgerock.services.context.Context context, String topic, JsonValue event) Publishes an event to the provided topic.queryEvents
(org.forgerock.services.context.Context context, String topic, QueryRequest query, QueryResourceHandler handler) Query some events from the provided topic.Reads an event with the provided resource id from the provided topic.void
shutdown()
Instruct this object to flush any buffers and close any open file handles or network connections.void
startup()
Instruct this object that it is safe to initialize file handles and network connections.Methods inherited from class org.forgerock.audit.events.handlers.AuditEventHandlerBase
getHandledTopics, getName, handleAction, isEnabled
-
Constructor Details
-
SplunkAuditEventHandler
public SplunkAuditEventHandler(SplunkAuditEventHandlerConfiguration configuration, EventTopicsMetaData eventTopicsMetaData, BatchPublisherFactory publisherFactory, org.forgerock.http.Client client) Constructs a new Splunk audit event handler.- Parameters:
configuration
- the Splunk audit event handler configurationeventTopicsMetaData
- topic meta datapublisherFactory
- the batch publisher factory ornull
client
- HTTP client ornull
-
-
Method Details
-
startup
Description copied from interface:AuditEventHandler
Instruct this object that it is safe to initialize file handles and network connections.Reconfiguration of the
AuditService
and its handlers is achieved by replacing rather than modifying the existing objects. Therefore, it's essential that the replacements do not perform any I/O that would interfere with the operation of the objects they are replacing until the old objects are shutdown. For example, when shutting down an old instance of a file-based AuditEventHandler, the old instance may need to flush buffers, apply file rotation or retention policies, or even add line or block signatures as part of tamper evident logging. Any of these operations could be broken if two handler instances are operating on the same set of files simultaneously.- Specified by:
startup
in interfaceAuditEventHandler
- Throws:
ResourceException
- if starting the AuditEventHandler fails
-
shutdown
Description copied from interface:AuditEventHandler
Instruct this object to flush any buffers and close any open file handles or network connections.- Specified by:
shutdown
in interfaceAuditEventHandler
- Throws:
ResourceException
- if closing the AuditEventHandler fails
-
publishEvent
public Promise<ResourceResponse,ResourceException> publishEvent(org.forgerock.services.context.Context context, String topic, JsonValue event) Description copied from interface:AuditEventHandler
Publishes an event to the provided topic.Note for implementors, it is imperative that the supplied
event
is not modified in any way as this may cause undesirable behaviour where multiple handlers are configured. If theevent
must be modified, then make a copy of it and work with that.- Specified by:
publishEvent
in interfaceAuditEventHandler
- Parameters:
context
- The context chain that initiated the event.topic
- The topic where to publish the event.event
- The event to publish - which should be considered immutable.- Returns:
- a promise with either a response or an exception
-
readEvent
public Promise<ResourceResponse,ResourceException> readEvent(org.forgerock.services.context.Context context, String topic, String resourceId) Description copied from interface:AuditEventHandler
Reads an event with the provided resource id from the provided topic.- Specified by:
readEvent
in interfaceAuditEventHandler
- Parameters:
context
- The context chain that initiated the event.topic
- The topic where event is read.resourceId
- The identifier of the event.- Returns:
- a promise with either a response or an exception
-
queryEvents
public Promise<QueryResponse,ResourceException> queryEvents(org.forgerock.services.context.Context context, String topic, QueryRequest query, QueryResourceHandler handler) Description copied from interface:AuditEventHandler
Query some events from the provided topic.- Specified by:
queryEvents
in interfaceAuditEventHandler
- Parameters:
context
- The context chain that initiated the event.topic
- The topic on which query is performed.query
- The request with the query.handler
- The handler to process responses for the query.- Returns:
- a promise with either a response or an exception
-
addToBatch
Description copied from interface:BatchConsumer
Adds an audit event to a batch payload.- Specified by:
addToBatch
in interfaceBatchConsumer
- Parameters:
topic
- event topicevent
- event JSON payloadpayload
- batch payload- Throws:
BatchException
- indicates failure to add-to-batch
-
publishBatch
Description copied from interface:BatchConsumer
Publishes the batch payload.- Specified by:
publishBatch
in interfaceBatchConsumer
- Parameters:
payload
- batch payload- Returns:
- a simple promise encapsulating any potential batch exception
-