How to get IP of machine in output?


(Punit Naik) #1

Logstash by default appends hostname in the output. I wanted to append also the IP of that machine. How do I do this? Please help!


(Magnus Bäck) #2

Would the dns filter be helpful? Also, see below.


(Punit Naik) #3

Actually that's not what I exactly want @magnusbaeck . I want the machine to write its IP address directly and not go through DNS. I want the IP address of eth0 interface to be precise. Isn't there a way in which I can sort of run a bash command inside the conf file and get the IP address of eth0 interface?


(Magnus Bäck) #4

You could do that with a ruby filter, but keep in mind that running a process for every event becomes very costly as the event rate goes up. Another option could be to use the translate filter to add the IP address from a periodically reloaded external file. That file could e.g. be maintained by a cron job, depending on how often the IP address changes.


(system) #5