Skip to content

Commit

Permalink
Add continent-based city databases. Fixes #121
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Jul 21, 2017
1 parent c340a54 commit 632a371
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/logstash/filters/GeoIPFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public class GeoIPFilter {

// The paid GeoIP2 databases
private static final String CITY_DB_TYPE = "GeoIP2-City";
private static final String CITY_AFRICA_DB_TYPE = "GeoIP2-City-Africa";
private static final String CITY_ASIA_PACIFIC_DB_TYPE = "GeoIP2-City-Asia-Pacific";
private static final String CITY_EUROPE_DB_TYPE = "GeoIP2-City-Europe";
private static final String CITY_NORTH_AMERICA_DB_TYPE = "GeoIP2-City-North-America";
private static final String CITY_SOUTH_AMERICA_DB_TYPE = "GeoIP2-City-South-America";
private static final String COUNTRY_DB_TYPE = "GeoIP2-Country";
private static final String ISP_DB_TYPE = "GeoIP2-ISP";

Expand Down Expand Up @@ -77,6 +82,11 @@ private Set<Fields> createDesiredFields(List<String> fields) {
switch (databaseReader.getMetadata().getDatabaseType()) {
case CITY_LITE_DB_TYPE:
case CITY_DB_TYPE:
case CITY_AFRICA_DB_TYPE:
case CITY_ASIA_PACIFIC_DB_TYPE:
case CITY_EUROPE_DB_TYPE:
case CITY_NORTH_AMERICA_DB_TYPE:
case CITY_SOUTH_AMERICA_DB_TYPE:
desiredFields = Fields.DEFAULT_CITY_FIELDS;
break;
case COUNTRY_LITE_DB_TYPE:
Expand Down Expand Up @@ -122,6 +132,11 @@ public boolean handleEvent(RubyEvent rubyEvent) {
switch (databaseReader.getMetadata().getDatabaseType()) {
case CITY_LITE_DB_TYPE:
case CITY_DB_TYPE:
case CITY_AFRICA_DB_TYPE:
case CITY_ASIA_PACIFIC_DB_TYPE:
case CITY_EUROPE_DB_TYPE:
case CITY_NORTH_AMERICA_DB_TYPE:
case CITY_SOUTH_AMERICA_DB_TYPE:
geoData = retrieveCityGeoData(ipAddress);
break;
case COUNTRY_LITE_DB_TYPE:
Expand Down

0 comments on commit 632a371

Please sign in to comment.