# GeoIP - locate ip address from text file

**URL:** <https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039>\
**Category:** Logstash\
**Created:** [October 17, 2019, 11:39am UTC](https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039 "2019-10-17T11:39:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladpov](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@Vladpov](https://discuss.elastic.co/u/Vladpov)\
**Post date:** [October 17, 2019, 11:39am UTC](https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039/1 "2019-10-17T11:39:43Z")

</div>

Hey guys,

I was wondering if I can see location of IP address when insert an IP address from text file via logstash with filter for geoip in it.

I was trying it with Apache log line sample from [GeoIP in the Elastic Stack](https://www.elastic.co/blog/geoip-in-the-elastic-stack) tutorial. I created a new index

```
PUT my_index
{
  "mappings": {
    "properties": {
      "location": {
        "type": "geo_point"
      }
    }
  }
}

```

And then changed filter in logstash config file for:

```
filter {
  grok { match => { "message" => "%{COMBINEDAPACHELOG}" } }
  geoip { source => "clientip" }
}

```

The output I see in Kibana:

```
               Time geoip.ip geoip.timezone geoip.location.lat geoip.location.lon geoip.continent_code  
Oct 17, 2019 @ 11:41:23.231	162.156.141.3	Europe/London 51.496 -0.122 EU

```

When I try to make a new visualisation with Coordinate Map I have there geopoint location but no points in map are shown.

In Index Pattern settings I don't have field clientip as geo\_point but String.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 17, 2019, 3:09pm UTC](https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039/2 "2019-10-17T15:09:55Z")

</div>

The default [target](https://www.elastic.co/guide/en/logstash/current/plugins-filters-geoip.html#plugins-filters-geoip-target) for a geoip filter is a field called geoip. The default [template](https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/c059723a51068e37c70bb0dc86123aea03d19871/lib/logstash/outputs/elasticsearch/elasticsearch-template-es7x.json#L33) for indexes that match logstash-\* makes that a geo\_point.

You are on the right lines, but you need to make [geoip][location] a geo\_point, not [location]. See the template above for how to do that.

---

<div class="post-metadata">

**Author:** ![Vladpov](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@Vladpov](https://discuss.elastic.co/u/Vladpov)\
**Post date:** [October 17, 2019, 7:04pm UTC](https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039/4 "2019-10-17T19:04:22Z")

</div>

Thank you for your help! It works 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:** [November 14, 2019, 7:04pm UTC](https://discuss.elastic.co/t/geoip-locate-ip-address-from-text-file/204039/5 "2019-11-14T19:04:33Z")

</div>

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