An interceptor's functionality can be summed up with this method:
public Event intercept(Event event);
A Flume event is passed to it, and it returns a Flume event. It may do nothing, in which case, the same unaltered event is returned. Often, it alters the event in some useful way. If null
is returned, the event is dropped.
To add interceptors to a source, simply add the interceptors
property to the named source, for example:
agent.sources.s1.interceptors=i1 i2 i3
This defines three interceptors: i1
, i2
, and i3
on the s1
source for the agent named agent
.
Note
Interceptors are run in the order in which they are listed. In the preceding example, i2
will receive the output from i1
. Then, i3
will receive the output from i2
. Finally, the channel selector receives the output from i3
.
Now that we have defined the interceptor by name, we need to specify its type as follows:
agent.sources.s1.interceptors.i1.type=TYPE1 agent.sources.s1.interceptors.i1.additionalProperty1=VALUE agent.sources.s1...