# Logstash IP to Hostname

**URL:** https://discuss.elastic.co/t/logstash-ip-to-hostname/92912
**Category:** Logstash
**Created:** [July 13, 2017, 3:31am UTC](https://discuss.elastic.co/t/logstash-ip-to-hostname/92912 "2017-07-13T03:31:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vvserpent](https://avatars.discourse-cdn.com/v4/letter/v/a698b9/32.png) [@vvserpent](https://discuss.elastic.co/u/vvserpent)
#### Post date: [July 13, 2017, 3:31am UTC](https://discuss.elastic.co/t/logstash-ip-to-hostname/92912/1 "2017-07-13T03:31:45Z")

</div>

I have configured Logstash to receive the syslog message from the networking devices. The dnsmasq and static host-file are used to translate the IP address to hostname. The system is working for few months.

I have changed the hostname of a IP in the host-file and restarted the dnsmasq recently . The nslookup can output the updated hostname. But in the Kibana dashboard, I found the system still using the old hostname .

Could you tell me how to update the hostname field for the specific IP ?

Here is the logstash configuration for the syslog.

input {  
udp{  
type =\> syslog  
port =\> 5140  
tags =\> []

}  
}

mutate {  
add\_field =\> { "hostname" =\> "%{host}" }  
}  
dns {  
action =\> "replace"  
reverse =\> ["hostname"]  
#add\_tag =\> ["dns\_lookup"]  
}

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [July 13, 2017, 6:05am UTC](https://discuss.elastic.co/t/logstash-ip-to-hostname/92912/2 "2017-07-13T06:05:54Z")

</div>

I wonder if the dns filter by default uses /etc/hosts. Have you tried pointing the `hostsfile` parameter to /etc/hosts?

---

<div class="post-metadata">

### Author: ![vvserpent](https://avatars.discourse-cdn.com/v4/letter/v/a698b9/32.png) [@vvserpent](https://discuss.elastic.co/u/vvserpent)
#### Post date: [July 13, 2017, 6:59am UTC](https://discuss.elastic.co/t/logstash-ip-to-hostname/92912/3 "2017-07-13T06:59:48Z")

</div>

I thought dns plugin using the system DNS to resolve the hostname if hostsfile parameter is not specified.

There is no hostsfile parameter previously.

I have added the hostsfile parameter and Logstash can resolve the correct hostname now 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 10, 2017, 6:59am UTC](https://discuss.elastic.co/t/logstash-ip-to-hostname/92912/4 "2017-08-10T06:59:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
