From 9db15d581cd7fd32f94d752c2fd8922cc2e3bf36 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Thu, 30 Oct 2025 15:48:04 +0000 Subject: [PATCH 1/5] add error logs when MaxMind databases fail to deserialize custom field --- CHANGELOG.md | 3 +++ VERSION | 2 +- src/main/java/org/logstash/filters/geoip/GeoIPFilter.java | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e346136..a52ab7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 7.3.2 + - Add logs when MaxMind databases fail to deserialize custom field + ## 7.3.1 - Avoid to crash pipelines when lookup a database with customised fields. [#225](https://github.com/logstash-plugins/logstash-filter-geoip/pull/225) diff --git a/VERSION b/VERSION index 34a8f74..af2c571 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.3.1 \ No newline at end of file +7.3.2 \ No newline at end of file diff --git a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java index 81d245a..2efe933 100644 --- a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java +++ b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java @@ -53,7 +53,9 @@ public class GeoIPFilter implements Closeable { // for more details https://github.com/logstash-plugins/logstash-filter-geoip/issues/226 static class GeoIp2InvalidCustomFieldException extends GeoIp2Exception { public GeoIp2InvalidCustomFieldException(Throwable cause) { - super("invalid custom field", cause); + super(cause.getMessage().equals("Cannot invoke \"Object.getClass()\" because \"parameters[index]\" is null") ? + "The database contains custom fields causing argument type mismatch." : + cause.getMessage(), cause); } } @@ -199,7 +201,7 @@ public boolean handleEvent(RubyEvent rubyEvent) { } catch (AddressNotFoundException e) { logger.debug("IP not found! exception={}, field={}, event={}", e, sourceField, event); } catch (GeoIp2Exception | IOException e) { - logger.debug("GeoIP2 Exception. exception={}, field={}, event={}", e, sourceField, event); + logger.error("Error from GeoIP database. field={}, value={}", sourceField, ip, e); } return applyGeoData(geoData, event); From c6a09743c7745d0d55a51c68a8c54d99ff87033d Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Thu, 30 Oct 2025 15:51:19 +0000 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a52ab7a..5af729f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## 7.3.2 - - Add logs when MaxMind databases fail to deserialize custom field + - Add logs when MaxMind databases fail to deserialize custom field [#235](https://github.com/logstash-plugins/logstash-filter-geoip/pull/235) ## 7.3.1 - Avoid to crash pipelines when lookup a database with customised fields. [#225](https://github.com/logstash-plugins/logstash-filter-geoip/pull/225) From e4a5c392c296c5b971d5d5ad9604164e2f7af5f8 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Thu, 30 Oct 2025 16:34:26 +0000 Subject: [PATCH 3/5] update error msg --- src/main/java/org/logstash/filters/geoip/GeoIPFilter.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java index 2efe933..cc9dd88 100644 --- a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java +++ b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java @@ -53,9 +53,7 @@ public class GeoIPFilter implements Closeable { // for more details https://github.com/logstash-plugins/logstash-filter-geoip/issues/226 static class GeoIp2InvalidCustomFieldException extends GeoIp2Exception { public GeoIp2InvalidCustomFieldException(Throwable cause) { - super(cause.getMessage().equals("Cannot invoke \"Object.getClass()\" because \"parameters[index]\" is null") ? - "The database contains custom fields causing argument type mismatch." : - cause.getMessage(), cause); + super("The database contains custom fields causing argument type mismatch.", cause); } } From ac5844914d39930125fea28a788dc0b53a4640d5 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Thu, 30 Oct 2025 17:41:41 +0000 Subject: [PATCH 4/5] update error msg --- src/main/java/org/logstash/filters/geoip/GeoIPFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java index cc9dd88..722dfda 100644 --- a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java +++ b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java @@ -53,7 +53,7 @@ public class GeoIPFilter implements Closeable { // for more details https://github.com/logstash-plugins/logstash-filter-geoip/issues/226 static class GeoIp2InvalidCustomFieldException extends GeoIp2Exception { public GeoIp2InvalidCustomFieldException(Throwable cause) { - super("The database contains custom fields causing argument type mismatch.", cause); + super("The database contains invalid custom field, which caused deserialization to fail.", cause); } } From df6fe4126454d5451b69b39962505f13b30ffde5 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Tue, 4 Nov 2025 11:34:09 +0000 Subject: [PATCH 5/5] format --- src/main/java/org/logstash/filters/geoip/GeoIPFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java index 722dfda..c3048f9 100644 --- a/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java +++ b/src/main/java/org/logstash/filters/geoip/GeoIPFilter.java @@ -53,7 +53,7 @@ public class GeoIPFilter implements Closeable { // for more details https://github.com/logstash-plugins/logstash-filter-geoip/issues/226 static class GeoIp2InvalidCustomFieldException extends GeoIp2Exception { public GeoIp2InvalidCustomFieldException(Throwable cause) { - super("The database contains invalid custom field, which caused deserialization to fail.", cause); + super("The database contains invalid custom field, which caused deserialization to fail.", cause); } }