Closed tommiv closed 4 years ago
The following configuration will generate the below results:
<source>
@type dummy
@id dummy
dummy [{"host":"","message":"this is test message"}]
tag "dummy"
</source>
<filter dummy>
@type geoip
backend_library geoip2_c
geoip_lookup_keys host
<record>
geoip_city ${city.names.en["host"]}
</record>
</filter>
<match dummy>
@type stdout
</match>
Current behavior:
2020-05-30 21:55:27 +0900 [warn]: #0 dump an error event: error_class=GeoIP2::Error error="getaddrinfo failed: Name or service not known" location="/home/kenji/wc/src/github.com/y-ken/fluent-plugin-geoip/lib/fluent/plugin/filter_geoip.rb:175:in `lookup'" tag="dummy" time=2020-05-30 21:55:27.072298297 +0900 record={"host"=>"", "message"=>"this is test message"}
2020-05-30 21:55:27.072298297 +0900 dummy: {"host":"","message":"this is test message"}
The above result did not add any fields to record.
2020-05-30 21:57:42 +0900 [warn]: #0 host is empty string
2020-05-30 21:57:42.065259460 +0900 dummy: {"host":"","message":"this is test message","geoip_city":null}
The above result added geoip_city
field specified in the configuration.
Problem
It looks like if the
geoip_lookup_keys
key => value is present, but equals an empty string, the plugins throws an exception. This break further fluentd filters chain processing and therefore the record is just thrown away.Steps to replicate
Just try to ingest such a record:
with this config:
I get this error:
{"error":"#<GeoIP2::Error: getaddrinfo failed: Name or service not known>","location":"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-geoip-1.3.1/lib/fluent/plugin/filter_geoip.rb:175:in
lookup'" ...`Expected Behavior
The plugin should leave the record unmodified.
Your environment
td-agent --version
: td-agent 1.10.2