Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Flume >> mail # user >> Host Interceptor


+
Brock Noland 2012-12-04, 17:15
+
DeCarlo, Thom 2012-12-06, 16:16
Copy link to this message
-
Re: Host Interceptor
Yes, I actually feel like that would be a good Serializer to have
upstream. I created a JIRA for it:
https://issues.apache.org/jira/browse/FLUME-1770

Brock

On Thu, Dec 6, 2012 at 10:16 AM, DeCarlo, Thom <[EMAIL PROTECTED]> wrote:
> Instead of changing the body text in an interceptor, I made a modified BodyTextEventSerializer.java called HeaderAndBodyTextEventSerialzer.java. The only difference, other than the class name, was two lines in the write() function:
>
>   @Override
>   public void write(Event e) throws IOException {
>     String eString = e.getHeaders() + " ";
>     out.write(eString.getBytes());
>     out.write(e.getBody());
>     if (appendNewline) {
>       out.write('\n');
>     }
>   }
>
> The configuration file then adds the serializer to the sink specification:
> agent1.sinks.fileSink-1.sink.serializer = org.apache.flume.serialization.HeaderAndBodyTextEventSerializer$Builder
>
> I should probably move my changes to my own local class, but this works for now.
> --
> Thom DeCarlo
>
> On Tue, 04 Dec 2012 17:15:06 GMT, Brock Noland <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> The host interceptor adds the host to the headers, not the body. You'd
>> need to create a new one to add it to the event.
>>
>> Brock

--
Apache MRUnit - Unit testing MapReduce - http://incubator.apache.org/mrunit/