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.util.ResourceLoaderAware,SolrInfoBean,SolrMetricProducer
public class MultiDestinationAuditLogger
extends AuditLoggerPlugin
implements org.apache.lucene.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.MuteRuleNested 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, requestTimes, solrMetricsContextFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaudit(AuditEvent event) Passes the AuditEvent to all sub plugins in parallel.voidclose()Waits 30s for async queue to drain, then closes executor threads.voidinform(org.apache.lucene.util.ResourceLoader loader) voidInitialize the plugin from security.jsonvoidinitializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Implementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/componentbooleanshouldLog(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, getName, getSolrMetricsContext, run, setFormatter, shouldMute, waitForQueueToDrain
-
Constructor Details
-
MultiDestinationAuditLogger
public MultiDestinationAuditLogger()
-
-
Method Details
-
audit
Passes the AuditEvent to all sub plugins in parallel. The event should be aAuditEventto be able to pull context info.- Specified by:
auditin classAuditLoggerPlugin- Parameters:
event- the audit event
-
init
Initialize the plugin from security.json- Overrides:
initin classAuditLoggerPlugin- Parameters:
pluginConfig- the config for the plugin
-
shouldLog
Description copied from class:AuditLoggerPluginChecks whether this event type should be logged based on "eventTypes" config parameter.- Overrides:
shouldLogin classAuditLoggerPlugin- Parameters:
eventType- the event type to consider- Returns:
- true if this event type should be logged
-
inform
public void inform(org.apache.lucene.util.ResourceLoader loader) - Specified by:
informin interfaceorg.apache.lucene.util.ResourceLoaderAware
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Description copied from interface:SolrMetricProducerImplementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/component- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Overrides:
initializeMetricsin classAuditLoggerPlugin- Parameters:
parentContext- The registry that the component will initialize metrics toattributes- Base set of attributes that will be bound to all metrics for that component
-
close
Description copied from class:AuditLoggerPluginWaits 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSolrMetricProducer- Overrides:
closein classAuditLoggerPlugin- Throws:
IOException
-