Class JsonAuditEventHandler
- All Implemented Interfaces:
- AuditEventHandler
AuditEventHandler for persisting raw JSON events to a file.
 The file format is a UTF-8 text-file, with one JSON event per line, and each line terminated by a newline character.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringName of action to force flushing of file-buffer, which is not the same as flushing buffered audit events, and is primarily used for testing purposes.static final StringName of action to force file rotation.Fields inherited from class org.forgerock.audit.events.handlers.AuditEventHandlerBaseeventTopicsMetaData
- 
Constructor SummaryConstructorsConstructorDescriptionJsonAuditEventHandler(JsonAuditEventHandlerConfiguration configuration, EventTopicsMetaData eventTopicsMetaData) Creates aJsonAuditEventHandlerinstances.
- 
Method SummaryModifier and TypeMethodDescriptionhandleAction(Context context, String topic, ActionRequest request) Performs an action.publishEvent(Context context, String topic, JsonValue event) Publishes an event to the provided topic.queryEvents(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.voidshutdown()Instruct this object to flush any buffers and close any open file handles or network connections.voidstartup()Instruct this object that it is safe to initialize file handles and network connections.Methods inherited from class org.forgerock.audit.events.handlers.AuditEventHandlerBasegetHandledTopics, getName, isEnabled
- 
Field Details- 
ROTATE_FILE_ACTION_NAMEName of action to force file rotation.- See Also:
 
- 
FLUSH_FILE_ACTION_NAMEName of action to force flushing of file-buffer, which is not the same as flushing buffered audit events, and is primarily used for testing purposes.- See Also:
 
 
- 
- 
Constructor Details- 
JsonAuditEventHandlerpublic JsonAuditEventHandler(JsonAuditEventHandlerConfiguration configuration, EventTopicsMetaData eventTopicsMetaData) Creates aJsonAuditEventHandlerinstances.- Parameters:
- configuration- Configuration
- eventTopicsMetaData- Provides meta-data describing the audit event topics this handler may have to handle.
 
 
- 
- 
Method Details- 
startupDescription copied from interface:AuditEventHandlerInstruct this object that it is safe to initialize file handles and network connections.Reconfiguration of the AuditServiceand 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.- Throws:
- ResourceException- if starting the AuditEventHandler fails
 
- 
shutdownDescription copied from interface:AuditEventHandlerInstruct this object to flush any buffers and close any open file handles or network connections.- Throws:
- ResourceException- if closing the AuditEventHandler fails
 
- 
publishEventpublic Promise<ResourceResponse,ResourceException> publishEvent(Context context, String topic, JsonValue event) Description copied from interface:AuditEventHandlerPublishes an event to the provided topic.Note for implementors, it is imperative that the supplied eventis not modified in any way as this may cause undesirable behaviour where multiple handlers are configured. If theeventmust be modified, then make a copy of it and work with that.- 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
 
- 
readEventpublic Promise<ResourceResponse,ResourceException> readEvent(Context context, String topic, String resourceId) Description copied from interface:AuditEventHandlerReads an event with the provided resource id from the provided topic.- 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
 
- 
queryEventspublic Promise<QueryResponse,ResourceException> queryEvents(Context context, String topic, QueryRequest query, QueryResourceHandler handler) Description copied from interface:AuditEventHandlerQuery some events from the provided topic.- 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
 
- 
handleActionpublic Promise<ActionResponse,ResourceException> handleAction(Context context, String topic, ActionRequest request) Description copied from interface:AuditEventHandlerPerforms an action.- Specified by:
- handleActionin interface- AuditEventHandler
- Overrides:
- handleActionin class- AuditEventHandlerBase
- Parameters:
- context- The context chain that initiated the event.
- topic- The topic on which action is performed.
- request- The request with the action.
- Returns:
- a promise with either a response or an exception
 
 
-