# Specify data type IP in logstash

**URL:** <https://discuss.elastic.co/t/specify-data-type-ip-in-logstash/29384>\
**Category:** Logstash\
**Created:** [September 16, 2015, 11:35am UTC](https://discuss.elastic.co/t/specify-data-type-ip-in-logstash/29384 "2015-09-16T11:35:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hayder\_Abbass](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayder_abbass/32/4559_2.png) [@Hayder\_Abbass](https://discuss.elastic.co/u/Hayder_Abbass)\
**Post date:** [September 16, 2015, 11:35am UTC](https://discuss.elastic.co/t/specify-data-type-ip-in-logstash/29384/1 "2015-09-16T11:35:47Z")

</div>

Hello,

We are pushing data in ElasticSearch via logstash. The issue is that for the IP address, it is being stored as a string rather as an IP data type. Is it possible to specify it via grok? I have tried the follow code below but it does not seem to work.

```
> ip { match => ["ip", "IPV4"] }
```

---

<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:** [September 16, 2015, 11:40am UTC](https://discuss.elastic.co/t/specify-data-type-ip-in-logstash/29384/2 "2015-09-16T11:40:44Z")

</div>

A grok or mutate filter can only convert values between JSON datatypes. To store IP addresses as the "ip" type in Elasticsearch you need to modify the index's mapping , typically by modifying the index template used by the elasticsearch output.

---

<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:29am UTC](https://discuss.elastic.co/t/specify-data-type-ip-in-logstash/29384/3 "2017-07-06T05:29:00Z")

</div>


