# Convert site name to IP address in Logstash

**URL:** https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753
**Category:** Logstash
**Created:** [June 16, 2015, 12:41am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753 "2015-06-16T00:41:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Mark\_Nuttall](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mark\_Nuttall](https://discuss.elastic.co/u/Mark_Nuttall)
#### Post date: [June 16, 2015, 12:41am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/1 "2015-06-16T00:41:23Z")

</div>

I am parsing Apache log files and, instead of IP addressess , it mostly contains things like [ec2-54-200-236-252.us-west-2.compute.amazonaws.com](http://ec2-54-200-236-252.us-west-2.compute.amazonaws.com) . I have tried the DNS filter to no avail. I'd like to have the IP address so i can use it with geoip. If i ping the "name", i get the IP address. Any ideas on if Logstash supports this or if there is a 3rd party plugin for it? I have googled a bunch and have come up empty.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [June 16, 2015, 12:43am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/2 "2015-06-16T00:43:24Z")

</div>

A [reverse DNS](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dns.html#plugins-filters-dns-reverse) filter didn't work?

---

<div class="post-metadata">

### Author: ![Mark\_Nuttall](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mark\_Nuttall](https://discuss.elastic.co/u/Mark_Nuttall)
#### Post date: [June 16, 2015, 12:50am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/3 "2015-06-16T00:50:58Z")

</div>

Not for me. not that i could tell. Maybe i just didnt have the config right. I've tried different things to include just passing the name via the stdin input. Below is an example of one of the things l tried. I get no error and nothing is added to the output.

input { stdin { } }

filter {  
mutate {  
strip =\> "message"  
}  
dns {  
reverse =\> ["source\_host", "message"]

}  
}

output {

stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [June 16, 2015, 1:03am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/4 "2015-06-16T01:03:48Z")

</div>

Stripping message means doing any subsequent filters on that won't work!

Also I think you should be using the [resolve filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dns.html#plugins-filters-dns-resolve) rather than reverse, cause we aren't doing a reverse lookup (I missed that earlier).

---

<div class="post-metadata">

### Author: ![Mark\_Nuttall](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mark\_Nuttall](https://discuss.elastic.co/u/Mark_Nuttall)
#### Post date: [June 16, 2015, 1:28am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/5 "2015-06-16T01:28:03Z")

</div>

I am using [strip](http://www.logstash.net/docs/1.4.0/filters/mutate#strip) to remove the /r just in case that was causing issues with my test. FYI - message still shows up in the output.

I had tried using resolve to no avail. As i said, that config file is just an example of the things i tried (and tried ..... ☹

---

<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: [July 6, 2017, 5:37am UTC](https://discuss.elastic.co/t/convert-site-name-to-ip-address-in-logstash/2753/6 "2017-07-06T05:37:23Z")

</div>


