org.apache.flume.interceptor

## Class RegexFilteringInterceptor

- java.lang.Object
- - org.apache.flume.interceptor.RegexFilteringInterceptor

- All Implemented Interfaces:
    Interceptor

      public class RegexFilteringInterceptor
      extends Object
      implements Interceptor

  Interceptor that filters events selectively based on a configured regular expression matching against the event body. This supports either include- or exclude-based filtering. A given interceptor can only perform one of these functions, but multiple interceptor can be chained together to create more complex inclusion/exclusion patterns. If include-based filtering is configured, then all events matching the supplied regular expression will be passed through and all events not matching will be ignored. If exclude-based filtering is configured, than all events matching will be ignored, and all other events will pass through. Note that all regular expression matching occurs through Java's built in java.util.regex package. Properties:

  regex: Regular expression for matching excluded events. (default is ".*")

  excludeEvents: If true, a regex match determines events to exclude, otherwise a regex determines events to include (default is false)

  Sample config:

  `agent.sources.r1.channels = c1`

  agent.sources.r1.type = SEQ

  agent.sources.r1.interceptors = i1

  agent.sources.r1.interceptors.i1.type = REGEX

  agent.sources.r1.interceptors.i1.regex = (WARNING)|(ERROR)|(FATAL)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RegexFilteringInterceptor.Builder` Builder which builds new instance of the StaticInterceptor.
    `static class` | `RegexFilteringInterceptor.Constants`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Perform any closing / shutdown needed by the Interceptor.
    `void` | `initialize()` Any initialization / startup needed by the Interceptor.
    `Event` | `intercept(Event event)` Interception of a single `Event`.
    `List<Event>` | `intercept(List<Event> events)` Returns the set of events which pass filters, according to `intercept(Event)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### initialize

          public void initialize()

      Description copied from interface: `Interceptor`
      Any initialization / startup needed by the Interceptor.
      Specified by:
        `initialize` in interface `Interceptor`

    - #### intercept

          public Event intercept(Event event)

      Description copied from interface: `Interceptor`
      Interception of a single `Event`.
      Specified by:
        `intercept` in interface `Interceptor`
      Parameters:
        `event` - Event to be intercepted
      Returns:
        Original or modified event, or `null` if the Event is to be dropped (i.e. filtered out).

    - #### intercept

          public List<Event> intercept(List<Event> events)

      Returns the set of events which pass filters, according to `intercept(Event)`.
      Specified by:
        `intercept` in interface `Interceptor`
      Parameters:
        `events` -
      Returns:

    - #### close

          public void close()

      Description copied from interface: `Interceptor`
      Perform any closing / shutdown needed by the Interceptor.
      Specified by:
        `close` in interface `Interceptor`

Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.