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.
  • Constructor Details

    • MultiDestinationAuditLogger

      public MultiDestinationAuditLogger()
  • Method Details

    • audit

      public void audit(AuditEvent event)
      Passes the AuditEvent to all sub plugins in parallel. The event should be a AuditEvent to be able to pull context info.
      Specified by:
      audit in class AuditLoggerPlugin
      Parameters:
      event - the audit event
    • init

      public void init(Map<String,Object> pluginConfig)
      Initialize the plugin from security.json
      Overrides:
      init in class AuditLoggerPlugin
      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 class AuditLoggerPlugin
      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:
      inform in interface org.apache.lucene.util.ResourceLoaderAware
    • initializeMetrics

      public void initializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes)
      Description copied from interface: SolrMetricProducer
      Implementation should initialize all metrics to a SolrMetricsContext Registry/MeterProvider with Attributes as the common set of attributes that will be attached to every metric that is initialized for that class/component
      Specified by:
      initializeMetrics in interface SolrMetricProducer
      Overrides:
      initializeMetrics in class AuditLoggerPlugin
      Parameters:
      parentContext - The registry that the component will initialize metrics to
      attributes - Base set of attributes that will be bound to all metrics for that component
    • 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 call super.close() or AuditLoggerPlugin.waitForQueueToDrain(int) before shutting itself down to make sure they can complete logging events in the queue.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface SolrMetricProducer
      Overrides:
      close in class AuditLoggerPlugin
      Throws:
      IOException