Skip to content

Conversation

@mashhurs
Copy link
Contributor

@mashhurs mashhurs commented Feb 5, 2026

Description

Upgrades maxmind geoip2 to 4.4.0 and maxmind-db version to 3.1.1.

Why specifically to these versions because geoip2 5.x available?

  • 5.x has breaking change(s). So far I know dma_code (metro code) is removed where LS is using. See draft PR for PoC - Try maxmind geoip 5.x version #237
  • aligns with Elasticsearch ingest-geoip module versions. It is not a requirement but nice to align
    • ES 8.x, 9.x and main branches use geoip2 to 4.2.1 and maxmind-db` 3.1.1 versions.

How to test?

!IMPORTANT - Tests are vibe coded but reviewed details.
Repo: https://github.com/mashhurs/geoip-compatibility-tests

Pull this PR and pull the test repo.
Set the GEOIP_PLUGIN_DIR with the path you have closed this PR in https://github.com/mashhurs/geoip-compatibility-tests/blob/f5e126713807e89873bc8f12dfa32f41cfcde7b4/run-tests.sh#L8

I have also pushed the recent result with 8.19, 9.3 and cross (ES 8.18 vs LS 9.3 or vice versa) - https://github.com/mashhurs/geoip-compatibility-tests/tree/main/results

// usage
./run-tests.sh help

Usage: ./run-tests.sh [quick|8.19|9.3|cross]

Modes:
  quick - Build and run unit tests only (no Docker)
  8.19  - Full test with ES/LS 8.19 (includes elastic_integration + data streams)
  9.3   - Full test with ES/LS 9.3 (includes elastic_integration + data streams)
  cross - Cross-version compatibility tests (all Docker services)

Tests include:
  - GeoIP 4.x plugin build and unit tests
  - ES GeoIP ingest processor
  - Logstash geoip filter (upgraded plugin)
  - elastic_integration filter with data streams

@mashhurs mashhurs changed the title Try maxmind geoip 4.x version. Upgrade maxmind geoip dependencies Feb 9, 2026
@mashhurs mashhurs linked an issue Feb 9, 2026 that may be closed by this pull request
@mashhurs mashhurs marked this pull request as ready for review February 9, 2026 18:03
@mashhurs mashhurs requested a review from kaisecheng February 9, 2026 18:04
@mashhurs mashhurs marked this pull request as draft February 9, 2026 18:04
break;
case AUTONOMOUS_SYSTEM_NUMBER:
Integer asn = response.getAutonomousSystemNumber();
final Long asn = response.getAutonomousSystemNumber();
Copy link
Contributor Author

@mashhurs mashhurs Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking if this Integer -> Long breaks the backward compatibility if result is saved into ES. Quick test with 8.19.last and 9.x versions seems by default numeric will be mapped as Long and this doesn't break unless if there is a strict Integer mapping.

POST /asn-type-test/_doc/1
{
  "ip": "8.8.8.8",
  "asn": 15169,
  "org": "Google LLC"
}

GET /asn-type-test/_mapping
// Results
{
  "asn-type-test": {
    "mappings": {
      "properties": {
        "asn": {
          "type": "long"
        },
        "ip": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "org": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

POST /asn-type-test/_doc/2
{
  "ip": "1.2.3.4",
  "asn": 4200000000,
  "org": "Test Large ASN"
}

GET /asn-type-test/_search

try {
response = databaseReader.city(ipAddress);
} catch (NullPointerException e) {
} catch (NullPointerException | DeserializationException e) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: after 4.x, on top of NPE there might be DeserializationException if there is invalid custom field data that can't be deserialized.

Remove unnecessary comment
@mashhurs mashhurs self-assigned this Feb 9, 2026
String junitVersion = '5.11.2' // at least 5.11 is needed to use @FieldSource with @ParameterizedTest
String maxmindGeoip2Version = '2.17.0'
String maxmindDbVersion = '2.1.0'
String maxmindGeoip2Version = '4.4.0'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

geoip2 interface started using maxmind-db 3.1.1 version from 4.2.1 and using the latest seems safe to me, reference - https://github.com/maxmind/GeoIP2-java/releases/tag/v4.2.1

@mashhurs mashhurs marked this pull request as ready for review February 9, 2026 21:49
@@ -1 +1 @@
7.3.3 No newline at end of file
7.4.0 No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did minor version upgrade since maxmind deps also upgraded to minors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version drops support of jvm 8. I consider it as breaking change and suggest to change the version to 8.0.0.

@@ -1,3 +1,6 @@
## 7.4.0
- Upgrade maxmind `geoip2` to 4.4.0 and `maxmind-db` to 3.1.1 versions [#238](https://github.com/logstash-plugins/logstash-filter-geoip/pull/238)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm., maybe worth to mention about asn type (Integer to Long) change if it break anything?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby only has Integer (BigInteger) type and your test shows the output is the same type, so my voice would be not mentioning here

Copy link
Contributor

@kaisecheng kaisecheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some questions about the dependency. We can take this chance to clean up the test cases for LS7 (example)

I have tested a few scenarios. All look good.

  • install in LS9 and query db
  • use this plugin to query old db and custom field db
  • install in LS7 and got rejected as expected

The plugin drops support on jvm 8. I think it is a breaking change. WDYT?

Comment on lines 82 to 84
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
exclude group: 'commons-codec', module: 'commons-codec'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

geoip2 4.x removed the dependency of apache httpclient and commons-codec. We can removed them too.

exclude group: 'commons-codec', module: 'commons-codec'
}

implementation group: "com.maxmind.db", name: "maxmind-db", version: maxmindDbVersion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the maxmind's changelog, starting from 4.0.1, com.maxmind.db is a transitive dependency of com.maxmind.geoip2. How about we drop the dependency?

@@ -1,3 +1,6 @@
## 7.4.0
- Upgrade maxmind `geoip2` to 4.4.0 and `maxmind-db` to 3.1.1 versions [#238](https://github.com/logstash-plugins/logstash-filter-geoip/pull/238)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby only has Integer (BigInteger) type and your test shows the output is the same type, so my voice would be not mentioning here

@@ -1 +1 @@
7.3.3 No newline at end of file
7.4.0 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version drops support of jvm 8. I consider it as breaking change and suggest to change the version to 8.0.0.

Comment on lines +95 to +96
// Jackson dependencies required by GeoIP2 4.x for JSON serialization (excluded above, needed for tests)
testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.17.2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to be able to run test without this dependency. Which test need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update geoip2 and maxmind-db versions

2 participants