Package org.apache.solr.security
Class MultiDestinationAuditLogger
- java.lang.Object
-
- org.apache.solr.security.AuditLoggerPlugin
-
- org.apache.solr.security.MultiDestinationAuditLogger
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Runnable
,org.apache.lucene.analysis.util.ResourceLoaderAware
,SolrInfoBean
,SolrMetricProducer
public class MultiDestinationAuditLogger extends AuditLoggerPlugin implements org.apache.lucene.analysis.util.ResourceLoaderAware
Audit logger that chains other loggers. Lets you configure logging to multiple destinations. The config is simply a list of configs for the sub plugins:"class" : "solr.MultiDestinationAuditLogger", "plugins" : [ { "class" : "solr.SolrLogAuditLoggerPlugin" }, { "class" : "solr.MyOtherAuditPlugin"} ]
This interface may change in next release and is marked experimental- Since:
- 8.1.0
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.security.AuditLoggerPlugin
AuditLoggerPlugin.AuditEventFormatter, AuditLoggerPlugin.JSONAuditEventFormatter, AuditLoggerPlugin.MuteRule
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
-
Fields inherited from class org.apache.solr.security.AuditLoggerPlugin
eventTypes, formatter, numErrors, numLogged, numLost, queuedTime, requestTimes, solrMetricsContext, totalTime
-
-
Constructor Summary
Constructors Constructor Description MultiDestinationAuditLogger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
audit(AuditEvent event)
Passes the AuditEvent to all sub plugins in parallel.void
close()
Waits 30s for async queue to drain, then closes executor threads.void
inform(org.apache.lucene.analysis.util.ResourceLoader loader)
void
init(Map<String,Object> pluginConfig)
Initialize the plugin from security.jsonvoid
initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Initializes metrics specific to this producerboolean
shouldLog(AuditEvent.EventType eventType)
Checks whether this event type should be logged based on "eventTypes" config parameter.-
Methods inherited from class org.apache.solr.security.AuditLoggerPlugin
auditAsync, doAudit, getCategory, getDescription, getMetricNames, getName, getSolrMetricsContext, initializeMetrics, run, setFormatter, shouldMute, waitForQueueToDrain
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricRegistry, getMetricsSnapshot, registerMetricName
-
-
-
-
Method Detail
-
audit
public void audit(AuditEvent event)
Passes the AuditEvent to all sub plugins in parallel. The event should be aAuditEvent
to be able to pull context info.- Specified by:
audit
in classAuditLoggerPlugin
- Parameters:
event
- the audit event
-
init
public void init(Map<String,Object> pluginConfig)
Initialize the plugin from security.json- Overrides:
init
in classAuditLoggerPlugin
- Parameters:
pluginConfig
- the config for the plugin
-
shouldLog
public boolean shouldLog(AuditEvent.EventType eventType)
Description copied from class:AuditLoggerPlugin
Checks whether this event type should be logged based on "eventTypes" config parameter.- Overrides:
shouldLog
in classAuditLoggerPlugin
- Parameters:
eventType
- the event type to consider- Returns:
- true if this event type should be logged
-
inform
public void inform(org.apache.lucene.analysis.util.ResourceLoader loader)
- Specified by:
inform
in interfaceorg.apache.lucene.analysis.util.ResourceLoaderAware
-
initializeMetrics
public void initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Description copied from interface:SolrMetricProducer
Initializes metrics specific to this producer- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
manager
- an instance ofSolrMetricManager
registryName
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer, or a group of related instances that have the same life-cycle. This tag is used when managing life-cycle of some metrics.scope
- scope of the metrics (eg. handler name) to separate metrics of components with the same implementation but different scope.
-
close
public void close() throws IOException
Description copied from class:AuditLoggerPlugin
Waits 30s for async queue to drain, then closes executor threads. Subclasses should either callsuper.close()
orAuditLoggerPlugin.waitForQueueToDrain(int)
before shutting itself down to make sure they can complete logging events in the queue.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSolrMetricProducer
- Overrides:
close
in classAuditLoggerPlugin
- Throws:
IOException
-
-