Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.
This repository was archived by the owner on May 31, 2021. It is now read-only.

Wrong IP address with ${HOSTNAME} #68

@dmitrime

Description

@dmitrime

I have the following interfaces on a remote AWS machine:

$ ifconfig

docker0   Link encap:Ethernet  HWaddr 02:42:BB:13:E8:25
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0      Link encap:Ethernet  HWaddr 0A:8C:15:E6:AF:9D
          inet addr:172.30.2.229  Bcast:172.30.2.255  Mask:255.255.255.0
          inet6 addr: fe80::88c:15ff:fee6:af9d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:2741444 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1601099 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3543604947 (3.3 GiB)  TX bytes:170417798 (162.5 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:51692380 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51692380 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:3391639364 (3.1 GiB)  TX bytes:3391639364 (3.1 GiB)

My app however, is not using docker and is deployed by simply copying it to home directory and running from there. I set the host in logger.xml:

...
      <layout class="me.moocar.logbackgelf.GelfLayout">
        <host>${HOSTNAME} </host>
      </layout>
...

Now, I go to Graylog where I send my log messages and see docker's IP as the source: 172.17.0.1. Since all the instances that got docker running seem to have the same IP, I cannot really tell which instance is producing which messages! How can I get the eth0 IP? Or identify the host in some other way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions