Skip to content

Commit 9db15d5

Browse files
committed
add error logs when MaxMind databases fail to deserialize custom field
1 parent 10a55f7 commit 9db15d5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 7.3.2
2+
- Add logs when MaxMind databases fail to deserialize custom field
3+
14
## 7.3.1
25
- Avoid to crash pipelines when lookup a database with customised fields. [#225](https://github.com/logstash-plugins/logstash-filter-geoip/pull/225)
36

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.3.1
1+
7.3.2

src/main/java/org/logstash/filters/geoip/GeoIPFilter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public class GeoIPFilter implements Closeable {
5353
// for more details https://github.com/logstash-plugins/logstash-filter-geoip/issues/226
5454
static class GeoIp2InvalidCustomFieldException extends GeoIp2Exception {
5555
public GeoIp2InvalidCustomFieldException(Throwable cause) {
56-
super("invalid custom field", cause);
56+
super(cause.getMessage().equals("Cannot invoke \"Object.getClass()\" because \"parameters[index]\" is null") ?
57+
"The database contains custom fields causing argument type mismatch." :
58+
cause.getMessage(), cause);
5759
}
5860
}
5961

@@ -199,7 +201,7 @@ public boolean handleEvent(RubyEvent rubyEvent) {
199201
} catch (AddressNotFoundException e) {
200202
logger.debug("IP not found! exception={}, field={}, event={}", e, sourceField, event);
201203
} catch (GeoIp2Exception | IOException e) {
202-
logger.debug("GeoIP2 Exception. exception={}, field={}, event={}", e, sourceField, event);
204+
logger.error("Error from GeoIP database. field={}, value={}", sourceField, ip, e);
203205
}
204206

205207
return applyGeoData(geoData, event);

0 commit comments

Comments
 (0)