[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flume-user
Subject:    Re: HDFS escape sequence and use of timestamp header
From:       Mohit Anchlia <mohitanchlia () gmail ! com>
Date:       2012-08-23 18:33:45
Message-ID: CAOT3TWq9cgLDD2wFjXcSJ7CTL1E+=jXNUQK2oHTXQ7EiYRnbMQ () mail ! gmail ! com
[Download RAW message or body]

thanks that works

On Wed, Aug 22, 2012 at 5:52 PM, Kathleen Ting <kathleen@apache.org> wrote:

> Mohit,
>
> As it happens, both the example and the table are correct. You can
> specify either the fully qualified class name or the alias 'TIMESTAMP'
>
> Regards, Kathleen
>
> On Wed, Aug 22, 2012 at 5:05 PM, Mohit Anchlia <mohitanchlia@gmail.com>
> wrote:
> >
> >
> > On Wed, Aug 22, 2012 at 2:16 PM, Kathleen Ting <kathleen@apache.org>
> wrote:
> >>
> >> Hi Mohit,
> >>
> >> You can configure a timestamp interceptor onto your source as follows:
> >>
> >> agent.sources.src-0.interceptors.ts.type = TIMESTAMP
> >>
> >> Once the timestamp interceptor is in place, you can use, in sinks, the
> >> timestamp it writes. Here is an example of using the timestamp in an
> >> HDFS sink:
> >>
> >> agent.sinks.sink-0.hdfs.filePrefix = FlumeData.%Y-%m-%d
> >>
> >> Here is more info about the timestamp interceptor:
> >> http://flume.apache.org/FlumeUserGuide.html#timestamp-interceptor
> >
> > Thanks this helps. The type specified in the example is a fully qualified
> > class name, however in the table it says use type as TIMESTAMP. I guess
> > example is not correct and I should just use TIMESTAMP.
> >>
> >> Regards, Kathleen
> >>
> >> On Wed, Aug 22, 2012 at 11:50 AM, Mohit Anchlia <mohitanchlia@gmail.com
> >
> >> wrote:
> >> > I see this JIRA https://issues.apache.org/jira/browse/FLUME-1215 but
> how
> >> > do
> >> > I take advantage of it? I am using 1.2.0 but %Y %m doesn't work. I
> just
> >> > get
> >> > number format exceptions.
> >> >
> >> >
> >> > On Tue, Aug 21, 2012 at 5:52 PM, Mohit Anchlia <
> mohitanchlia@gmail.com>
> >> > wrote:
> >> >>
> >> >> I am using flume-ng 1.2.0 and I need to use %Y%M%D escape sequence.
> Do
> >> >> I
> >> >> need to write some custom interceptor? Could you please point me to
> an
> >> >> example? Currently my AvroClient looks like this:
> >> >>
> >> >>
> >> >> public void sendDataToFlume(String data) {
> >> >>
> >> >> // Create flume event object
> >> >>
> >> >> Event event = EventBuilder.withBody(data, Charset.forName(
> >> >>
> >> >> "UTF-8"));
> >> >>
> >> >> Map<String,String> headers =
> >> >>
> >> >> new HashMap<String,String>();
> >> >>
> >> >> headers.put(
> >> >>
> >> >> "host", hostName);
> >> >>
> >> >> event.setHeaders(headers);
> >> >>
> >> >> try {
> >> >>
> >> >> rpcClient.append(event);
> >> >>
> >> >> }
> >> >>
> >> >> catch (EventDeliveryException e) {
> >> >>
> >> >> connect();
> >> >>
> >> >> }
> >> >>
> >> >> }
> >> >
> >> >
> >
> >
>

[Attachment #3 (text/html)]

thanks that works<br><br>
<div class="gmail_quote">On Wed, Aug 22, 2012 at 5:52 PM, Kathleen Ting <span \
dir="ltr">&lt;<a href="mailto:kathleen@apache.org" \
target="_blank">kathleen@apache.org</a>&gt;</span> wrote:<br> <blockquote \
style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" \
class="gmail_quote">Mohit,<br><br>As it happens, both the example and the table are \
correct. You can<br>specify either the fully qualified class name or the alias \
&#39;TIMESTAMP&#39;<br> <br>Regards, Kathleen<br>
<div class="HOEnZb">
<div class="h5"><br>On Wed, Aug 22, 2012 at 5:05 PM, Mohit Anchlia &lt;<a \
href="mailto:mohitanchlia@gmail.com">mohitanchlia@gmail.com</a>&gt; \
wrote:<br>&gt;<br>&gt;<br>&gt; On Wed, Aug 22, 2012 at 2:16 PM, Kathleen Ting &lt;<a \
href="mailto:kathleen@apache.org">kathleen@apache.org</a>&gt; wrote:<br> \
&gt;&gt;<br>&gt;&gt; Hi Mohit,<br>&gt;&gt;<br>&gt;&gt; You can configure a timestamp \
interceptor onto your source as follows:<br>&gt;&gt;<br>&gt;&gt; \
agent.sources.src-0.interceptors.ts.type = TIMESTAMP<br>&gt;&gt;<br>&gt;&gt; Once the \
timestamp interceptor is in place, you can use, in sinks, the<br> &gt;&gt; timestamp \
it writes. Here is an example of using the timestamp in an<br>&gt;&gt; HDFS \
sink:<br>&gt;&gt;<br>&gt;&gt; agent.sinks.sink-0.hdfs.filePrefix = \
FlumeData.%Y-%m-%d<br>&gt;&gt;<br>&gt;&gt; Here is more info about the timestamp \
interceptor:<br> &gt;&gt; <a \
href="http://flume.apache.org/FlumeUserGuide.html#timestamp-interceptor" \
target="_blank">http://flume.apache.org/FlumeUserGuide.html#timestamp-interceptor</a><br>&gt;<br>&gt; \
Thanks this helps. The type specified in the example is a fully qualified<br> &gt; \
class name, however in the table it says use type as TIMESTAMP. I guess<br>&gt; \
example is not correct and I should just use TIMESTAMP.<br>&gt;&gt;<br>&gt;&gt; \
Regards, Kathleen<br>&gt;&gt;<br>&gt;&gt; On Wed, Aug 22, 2012 at 11:50 AM, Mohit \
Anchlia &lt;<a href="mailto:mohitanchlia@gmail.com">mohitanchlia@gmail.com</a>&gt;<br>
 &gt;&gt; wrote:<br>&gt;&gt; &gt; I see this JIRA <a \
href="https://issues.apache.org/jira/browse/FLUME-1215" \
target="_blank">https://issues.apache.org/jira/browse/FLUME-1215</a> but \
how<br>&gt;&gt; &gt; do<br>&gt;&gt; &gt; I take advantage of it? I am using 1.2.0 but \
%Y %m doesn&#39;t work. I just<br> &gt;&gt; &gt; get<br>&gt;&gt; &gt; number format \
exceptions.<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; On Tue, Aug 21, 2012 \
at 5:52 PM, Mohit Anchlia &lt;<a \
href="mailto:mohitanchlia@gmail.com">mohitanchlia@gmail.com</a>&gt;<br> &gt;&gt; &gt; \
wrote:<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; I am using flume-ng 1.2.0 and I need \
to use %Y%M%D escape sequence. Do<br>&gt;&gt; &gt;&gt; I<br>&gt;&gt; &gt;&gt; need to \
write some custom interceptor? Could you please point me to an<br> &gt;&gt; &gt;&gt; \
example? Currently my AvroClient looks like this:<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; public void sendDataToFlume(String data) {<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; // Create flume event object<br> &gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; Event event = EventBuilder.withBody(data, \
Charset.forName(<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; \
&quot;UTF-8&quot;));<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; \
Map&lt;String,String&gt; headers =<br> &gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; new \
HashMap&lt;String,String&gt;();<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; \
headers.put(<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; &quot;host&quot;, \
hostName);<br>&gt;&gt; &gt;&gt;<br> &gt;&gt; &gt;&gt; \
event.setHeaders(headers);<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; try \
{<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; rpcClient.append(event);<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; }<br>&gt;&gt; &gt;&gt;<br> &gt;&gt; &gt;&gt; catch \
(EventDeliveryException e) {<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; \
connect();<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; }<br>&gt;&gt; \
&gt;&gt;<br>&gt;&gt; &gt;&gt; }<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br> \
&gt;<br>&gt;<br></div></div></blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic