Class AuditLoggerPlugin

    • Field Detail

      • registryName

        protected String registryName
      • numErrors

        protected com.codahale.metrics.Meter numErrors
      • numLost

        protected com.codahale.metrics.Meter numLost
      • numLogged

        protected com.codahale.metrics.Meter numLogged
      • requestTimes

        protected com.codahale.metrics.Timer requestTimes
      • queuedTime

        protected com.codahale.metrics.Timer queuedTime
      • totalTime

        protected com.codahale.metrics.Counter totalTime
    • Constructor Detail

      • AuditLoggerPlugin

        public AuditLoggerPlugin()
    • Method Detail

      • init

        public void init​(Map<String,​Object> pluginConfig)
        Initialize the plugin from security.json. This method removes parameters from config object after consuming, so subclasses can check for config errors.
        Parameters:
        pluginConfig - the config for the plugin
      • audit

        protected abstract void audit​(AuditEvent event)
        This is the method that each Audit plugin has to implement to do the actual logging.
        Parameters:
        event - the audit event
      • doAudit

        public final void doAudit​(AuditEvent event)
        Called by the framework, and takes care of metrics tracking and to dispatch to either synchronous or async logging.
      • shouldMute

        protected boolean shouldMute​(AuditEvent event)
        Returns true if any of the configured mute rules matches. The inner lists are ORed, while rules inside inner lists are ANDed
        Parameters:
        event - the audit event
      • auditAsync

        protected final void auditAsync​(AuditEvent event)
        Enqueues an AuditEvent to a queue and returns immediately. A background thread will pull events from this queue and call audit(AuditEvent)
        Parameters:
        event - the audit event
      • shouldLog

        public boolean shouldLog​(AuditEvent.EventType eventType)
        Checks whether this event type should be logged based on "eventTypes" config parameter.
        Parameters:
        eventType - the event type to consider
        Returns:
        true if this event type should be logged
      • getName

        public String getName()
        Description copied from interface: SolrInfoBean
        Simple common usage name, e.g. BasicQueryHandler, or fully qualified class name.
        Specified by:
        getName in interface SolrInfoBean
      • getMetricNames

        public Set<String> getMetricNames()
        Description copied from interface: SolrInfoBean
        Modifiable set of metric names that this component reports (default is null, which means none). If not null then this set is used by SolrInfoBean.registerMetricName(String) to capture what metrics names are reported from this component.

        NOTE: this set has to allow iteration under modifications.

        Specified by:
        getMetricNames in interface SolrInfoBean
      • getMetricRegistry

        public com.codahale.metrics.MetricRegistry getMetricRegistry()
        Description copied from interface: SolrInfoBean
        An instance of MetricRegistry that this component uses for metrics reporting (default is null, which means no registry).
        Specified by:
        getMetricRegistry in interface SolrInfoBean
      • waitForQueueToDrain

        protected void waitForQueueToDrain​(int timeoutSeconds)
        Blocks until the async event queue is drained
        Parameters:
        timeoutSeconds - number of seconds to wait for queue to drain