# Logstash GeoIP database support

**URL:** <https://discuss.elastic.co/t/logstash-geoip-database-support/230976>\
**Category:** Logstash\
**Created:** [May 4, 2020, 1:26pm UTC](https://discuss.elastic.co/t/logstash-geoip-database-support/230976 "2020-05-04T13:26:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_Mousavi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammad_mousavi/32/56508_2.png) [@Mohammad\_Mousavi](https://discuss.elastic.co/u/Mohammad_Mousavi)\
**Post date:** [May 4, 2020, 1:26pm UTC](https://discuss.elastic.co/t/logstash-geoip-database-support/230976/1 "2020-05-04T13:26:12Z")

</div>

Hi, I wanna buy a commercial IP2location database from [IP2Location](https://www.ip2location.com/database/db2-ip-country-isp) .  
I know I can use .bin file in logstash in GeoIP as a source database.  
In my scenario, I need to import this .bin or .csv database into mysql or postgres so my application can use it too and be able to even add some records in it.  
Can I use this mysql database (imported from .bin or .csv) as a Geoip databse source in logstash ?  
I mean instead of **database =\> "/etc/logstash/conf.d/IP2location.bin"** , I be able to use some thing like jdbc inside geoip section. Is this possible ?  
thanx a lot

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [May 4, 2020, 2:04pm UTC](https://discuss.elastic.co/t/logstash-geoip-database-support/230976/2 "2020-05-04T14:04:14Z")

</div>

I don’t know if that’s supported. but if you have the geo information inside a database, you could write a ruby script using ruby filter, taking the ip address field as input, query your mysql database, and return the geo information. you can then map the output to geo fields.

---

<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:** [May 4, 2020, 2:43pm UTC](https://discuss.elastic.co/t/logstash-geoip-database-support/230976/3 "2020-05-04T14:43:44Z")

</div>

> [@Mohammad\_Mousavi](#):
>
> Can I use this mysql database (imported from .bin or .csv) as a Geoip databse source in logstash ?

No. The [code](https://github.com/logstash-plugins/logstash-filter-geoip/blob/7bd79e10e3b3802f1ead494598b4a40305ba73f3/src/main/java/org/logstash/filters/GeoIPFilter.java#L68) reads a file.

---

<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:** [June 1, 2020, 2:43pm UTC](https://discuss.elastic.co/t/logstash-geoip-database-support/230976/4 "2020-06-01T14:43:50Z")

</div>

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