Class AuditLoggerPlugin

    • Field Detail

      • 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.
        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.
        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
        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)
        event - the audit event
      • shouldLog

        public boolean shouldLog​(AuditEvent.EventType eventType)
        Checks whether this event type should be logged based on "eventTypes" config parameter.
        eventType - the event type to consider
        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
      • waitForQueueToDrain

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