-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need more information extracted from GeoIP database not only lat or lng #107
Comments
Strange report as the default list of field is already quite exhaustive and contains the city_name : https://github.com/logstash-plugins/logstash-filter-geoip/blob/master/lib/logstash/filters/geoip.rb#L67 @keefeleen do you have a restricted fields config in your configuration ? |
Thanks for your replay, I checked over again that just as you said the default fields already contains the info we need. Then I found the problem that caused failure when we tried to extract city_name information. Since GeoIP filter uses GeoIP2-java lib. We found that before reading the database, the DatabaseReader class will compare database's metadata named "database_type" with the data type name we want (eg. "city"), if "database_type" doesn't contain the data type name, it will throw an exception and won't give the IP data we want. I think the related code is as follows in DatabaseReader.java:
Actually we want to know the exact purpose of adding this checking logic, and we also need to know the way to avoid failure when we do not want to use "city" or "country" in "database_type" while reading "city" or "country" information. Thanks in advance. |
@wiibaa hello, can you take a look at the question above? Since another team in our company build our own city level GeoIP database which follows MaxMind's standard and provide it for us to use. But the "database_type" the defined doesn't contain "city" in it so we cannot use logstash GeoIP plugin with it. Is there any way to avoid asking them to rebuild the database and make logstash GeoIP plugin compatible with the existing database? |
@keefeleen I'm sorry but this is how MaxMind DatabaseReader seems to work, logstash is simply calling this method
So your custom database must define the proper type otherwise Maxmind lib cannot use it, this is an issue of compatiblity with your database with maxmind lib, logstash cannot help much |
The logstash plugin does treat lat-lon specially. Even if the database has the right entries for e.g. city or country, the record is thrown out by logstash if it doesn't have a lat-lon.
This causes problems even with the official MaxMind databases. The GeoIP2-City-Europe DB, for example, has continent/country codes but no location fields for places outside Europe. |
@joewreschnig so you mean this assumption is wrong ?
Could you provide some examples, I cannot find easily on MaxMind documentation the description of such cases |
Yes, I believe that assumption is wrong, even for official MaxMind DBs. For example, when I look up a US IP in the GeoIP2-City-Europe DB, I get only the country, no location:
If I remove the check (and put appropriate guards around the assignments) the plugin handles the data just fine - I get a continent and country. |
@joewreschnig very interesting, it's true that the history of the geoip filter was mainly to retrieve the lat/lon and use it with a map widget in kibana, but that should not be the only use case. |
We have to extract province, city information from MaxMind GeoIP2 database when using logstash filter.
But it seems that logstash default geoip plugin can just provide "latitude" and "longitude" info.
Actually we write a plugin for info extraction, but we strongly recommend official plugin maintainer can update this plugin. Can future version add more fields that can be extracted from GeoIP2 databases?
Thanks in advance and waiting for your reply.
The text was updated successfully, but these errors were encountered: