org.apache.flume.interceptor
Class StaticInterceptor

java.lang.Object
  extended by org.apache.flume.interceptor.StaticInterceptor
All Implemented Interfaces:
Interceptor

public class StaticInterceptor
extends Object
implements Interceptor

Interceptor class that appends a static, pre-configured header to all events. Properties:

key: Key to use in static header insertion. (default is "key")

value: Value to use in static header insertion. (default is "value")

preserveExisting: Whether to preserve an existing value for 'key' (default is true)

Sample config:

agent.sources.r1.channels = c1

agent.sources.r1.type = SEQ

agent.sources.r1.interceptors = i1

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

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

agent.sources.r1.interceptors.i1.key = datacenter

agent.sources.r1.interceptors.i1.value= NYC_01


Nested Class Summary
static class StaticInterceptor.Builder
          Builder which builds new instance of the StaticInterceptor.
static class StaticInterceptor.Constants
           
 
Method Summary
 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-2013 Apache Software Foundation. All Rights Reserved.