org.apache.flume.interceptor

## Class HostInterceptor

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

- All Implemented Interfaces:
    Interceptor

      public class HostInterceptor
      extends Object
      implements Interceptor

  Simple Interceptor class that sets the host name or IP on all events that are intercepted.

  The host header is named `host` and its format is either the FQDN or IP of the host on which this interceptor is run. Properties:

  preserveExisting: Whether to preserve an existing value for 'host' (default is false)

  useIP: Whether to use IP address or fully-qualified hostname for 'host' header value (default is true)

  hostHeader: Specify the key to be used in the event header map for the host name. (default is "host")

  Sample config:

  `agent.sources.r1.channels = c1`

  agent.sources.r1.type = SEQ

  agent.sources.r1.interceptors = i1

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

  agent.sources.r1.interceptors.i1.preserveExisting = true

  agent.sources.r1.interceptors.i1.useIP = false

  agent.sources.r1.interceptors.i1.hostHeader = hostname

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `HostInterceptor.Builder` Builder which builds new instances of the HostInterceptor.
    `static class` | `HostInterceptor.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)` Modifies events in-place.
    `List<Event>` | `intercept(List<Event> events)` Delegates to `intercept(Event)` in a loop.

    - ### 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)

      Modifies events in-place.
      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)

      Delegates to `intercept(Event)` in a loop.
      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.