You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flume.apache.org by Denny Ye <de...@gmail.com> on 2013/01/18 10:33:08 UTC

Returns 127.0.0.1 at HostInterceptor

hi all, HostInterceptor obtains loopback address if there hasn't configure
for local server at /etc/hosts. Can we change the acquire method for local
IP. Currently, we are using 'InetAddress.getLocalHost().getHostAddress()'

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Denny Ye <de...@gmail.com>.
Sure, StatisInterceptor is another choice if I want to transfer pre-defined
IP to each event. This is a proposal for right local IP. In my situation,
several Flume servers cannot be distinguished with IP no matter in HDFS or
monitoring system. What do you think if original HostInterceptor support
effective function?



2013/1/18 Mike Percy <mp...@apache.org>

> Hi Denny,
> What are your thoughts for improving this? Maybe you want to consider
> submitting a patch?
>
> If you know what the string you want to use is, you might also consider
> using a StaticInterceptor.
>
> Regards,
> Mike
>
>
> On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:
>
> > hi all, HostInterceptor obtains loopback address if there hasn't
> configure
> > for local server at /etc/hosts. Can we change the acquire method for
> local
> > IP. Currently, we are using 'InetAddress.getLocalHost().getHostAddress()'
> >
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Mike Percy <mp...@apache.org>.
Hi Denny,
What are your thoughts for improving this? Maybe you want to consider
submitting a patch?

If you know what the string you want to use is, you might also consider
using a StaticInterceptor.

Regards,
Mike


On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:

> hi all, HostInterceptor obtains loopback address if there hasn't configure
> for local server at /etc/hosts. Can we change the acquire method for local
> IP. Currently, we are using 'InetAddress.getLocalHost().getHostAddress()'
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Ralph Goers <ra...@dslextreme.com>.
Sorry  to jump on this thread so late but you should be aware that getLocalHost() seems to have a nasty habit of throwing a HostNotFoundException on Java 7.  I ran into this in Log4j 2 and had to write some code to deal with that when it happens.  See http://blog.leon-rosenberg.net/2012/08/oracle-kills-getlocalhost-on-macos-x-in.html


Ralph


On Jan 18, 2013, at 2:37 AM, Mike Percy wrote:

> Sounds good, Denny. Yes, please file a Jira and post a patch.
> 
> Regards,
> Mike
> 
> On Friday, January 18, 2013, Denny Ye wrote:
> 
>> I have wrote some codes to resolve this problem for me, and I want to know
>> if someone also need this function to obtains actual IP. If it's useful for
>> others, I can post patch for it if necessary
>> 
>> 
>> 2013/1/18 Denny Ye <dennyy99@gmail.com <javascript:;>>
>> 
>>> The result of ' InetAddress.getLocalHost().getCanonicalHostName()' is
>>> 'localhost', what's your advice if I would like to distinguish the actual
>>> IP of my several Flume servers?
>>> 
>>> 
>>> 2013/1/18 Mike Percy <mpercy@apache.org <javascript:;>>
>>> 
>>>> Today, InetAddress.getLocalHost().getCanonicalHostName() is used if you
>>>> pass useIP = false to the interceptor config.
>>>> 
>>>> Regards,
>>>> Mike
>>>> 
>>>> 
>>>> 
>>>> On Fri, Jan 18, 2013 at 1:39 AM, Connor Woodson <cwoodson.dev@gmail.com<javascript:;>
>>>>> wrote:
>>>> 
>>>>> We could use InetAddress.getLocalHost().getCanonicalHostName() to get
>>>> just
>>>>> the IP, which I feel is good enough; a quick and dirty interceptor
>>>> could be
>>>>> built that substitutes certain names for their matching IP
>>>>> ('SubstitutionInterceptor'?) which would then work well with any other
>>>>> header-replacement needs someone would need.
>>>>> 
>>>>> - Connor
>>>>> 
>>>>> 
>>>>> On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <dennyy99@gmail.com<javascript:;>>
>> wrote:
>>>>> 
>>>>>> hi all, HostInterceptor obtains loopback address if there hasn't
>>>>> configure
>>>>>> for local server at /etc/hosts. Can we change the acquire method for
>>>>> local
>>>>>> IP. Currently, we are using
>>>> 'InetAddress.getLocalHost().getHostAddress()'
>>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 


Re: Returns 127.0.0.1 at HostInterceptor

Posted by Mike Percy <mp...@apache.org>.
Sounds good, Denny. Yes, please file a Jira and post a patch.

Regards,
Mike

On Friday, January 18, 2013, Denny Ye wrote:

> I have wrote some codes to resolve this problem for me, and I want to know
> if someone also need this function to obtains actual IP. If it's useful for
> others, I can post patch for it if necessary
>
>
> 2013/1/18 Denny Ye <dennyy99@gmail.com <javascript:;>>
>
> > The result of ' InetAddress.getLocalHost().getCanonicalHostName()' is
> > 'localhost', what's your advice if I would like to distinguish the actual
> > IP of my several Flume servers?
> >
> >
> > 2013/1/18 Mike Percy <mpercy@apache.org <javascript:;>>
> >
> >> Today, InetAddress.getLocalHost().getCanonicalHostName() is used if you
> >> pass useIP = false to the interceptor config.
> >>
> >> Regards,
> >> Mike
> >>
> >>
> >>
> >> On Fri, Jan 18, 2013 at 1:39 AM, Connor Woodson <cwoodson.dev@gmail.com<javascript:;>
> >> >wrote:
> >>
> >> > We could use InetAddress.getLocalHost().getCanonicalHostName() to get
> >> just
> >> > the IP, which I feel is good enough; a quick and dirty interceptor
> >> could be
> >> > built that substitutes certain names for their matching IP
> >> > ('SubstitutionInterceptor'?) which would then work well with any other
> >> > header-replacement needs someone would need.
> >> >
> >> > - Connor
> >> >
> >> >
> >> > On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <dennyy99@gmail.com<javascript:;>>
> wrote:
> >> >
> >> > > hi all, HostInterceptor obtains loopback address if there hasn't
> >> > configure
> >> > > for local server at /etc/hosts. Can we change the acquire method for
> >> > local
> >> > > IP. Currently, we are using
> >> 'InetAddress.getLocalHost().getHostAddress()'
> >> > >
> >> >
> >>
> >
> >
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Denny Ye <de...@gmail.com>.
I have wrote some codes to resolve this problem for me, and I want to know
if someone also need this function to obtains actual IP. If it's useful for
others, I can post patch for it if necessary


2013/1/18 Denny Ye <de...@gmail.com>

> The result of ' InetAddress.getLocalHost().getCanonicalHostName()' is
> 'localhost', what's your advice if I would like to distinguish the actual
> IP of my several Flume servers?
>
>
> 2013/1/18 Mike Percy <mp...@apache.org>
>
>> Today, InetAddress.getLocalHost().getCanonicalHostName() is used if you
>> pass useIP = false to the interceptor config.
>>
>> Regards,
>> Mike
>>
>>
>>
>> On Fri, Jan 18, 2013 at 1:39 AM, Connor Woodson <cwoodson.dev@gmail.com
>> >wrote:
>>
>> > We could use InetAddress.getLocalHost().getCanonicalHostName() to get
>> just
>> > the IP, which I feel is good enough; a quick and dirty interceptor
>> could be
>> > built that substitutes certain names for their matching IP
>> > ('SubstitutionInterceptor'?) which would then work well with any other
>> > header-replacement needs someone would need.
>> >
>> > - Connor
>> >
>> >
>> > On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:
>> >
>> > > hi all, HostInterceptor obtains loopback address if there hasn't
>> > configure
>> > > for local server at /etc/hosts. Can we change the acquire method for
>> > local
>> > > IP. Currently, we are using
>> 'InetAddress.getLocalHost().getHostAddress()'
>> > >
>> >
>>
>
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Denny Ye <de...@gmail.com>.
The result of ' InetAddress.getLocalHost().getCanonicalHostName()' is
'localhost', what's your advice if I would like to distinguish the actual
IP of my several Flume servers?


2013/1/18 Mike Percy <mp...@apache.org>

> Today, InetAddress.getLocalHost().getCanonicalHostName() is used if you
> pass useIP = false to the interceptor config.
>
> Regards,
> Mike
>
>
>
> On Fri, Jan 18, 2013 at 1:39 AM, Connor Woodson <cwoodson.dev@gmail.com
> >wrote:
>
> > We could use InetAddress.getLocalHost().getCanonicalHostName() to get
> just
> > the IP, which I feel is good enough; a quick and dirty interceptor could
> be
> > built that substitutes certain names for their matching IP
> > ('SubstitutionInterceptor'?) which would then work well with any other
> > header-replacement needs someone would need.
> >
> > - Connor
> >
> >
> > On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:
> >
> > > hi all, HostInterceptor obtains loopback address if there hasn't
> > configure
> > > for local server at /etc/hosts. Can we change the acquire method for
> > local
> > > IP. Currently, we are using
> 'InetAddress.getLocalHost().getHostAddress()'
> > >
> >
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Mike Percy <mp...@apache.org>.
Today, InetAddress.getLocalHost().getCanonicalHostName() is used if you
pass useIP = false to the interceptor config.

Regards,
Mike



On Fri, Jan 18, 2013 at 1:39 AM, Connor Woodson <cw...@gmail.com>wrote:

> We could use InetAddress.getLocalHost().getCanonicalHostName() to get just
> the IP, which I feel is good enough; a quick and dirty interceptor could be
> built that substitutes certain names for their matching IP
> ('SubstitutionInterceptor'?) which would then work well with any other
> header-replacement needs someone would need.
>
> - Connor
>
>
> On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:
>
> > hi all, HostInterceptor obtains loopback address if there hasn't
> configure
> > for local server at /etc/hosts. Can we change the acquire method for
> local
> > IP. Currently, we are using 'InetAddress.getLocalHost().getHostAddress()'
> >
>

Re: Returns 127.0.0.1 at HostInterceptor

Posted by Connor Woodson <cw...@gmail.com>.
We could use InetAddress.getLocalHost().getCanonicalHostName() to get just
the IP, which I feel is good enough; a quick and dirty interceptor could be
built that substitutes certain names for their matching IP
('SubstitutionInterceptor'?) which would then work well with any other
header-replacement needs someone would need.

- Connor


On Fri, Jan 18, 2013 at 1:33 AM, Denny Ye <de...@gmail.com> wrote:

> hi all, HostInterceptor obtains loopback address if there hasn't configure
> for local server at /etc/hosts. Can we change the acquire method for local
> IP. Currently, we are using 'InetAddress.getLocalHost().getHostAddress()'
>