fluent / fluent/fluent-bit

geoip2 always process logs, regardless if lookup_key exist

Open
#7,825 25 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C
Stars
8.1k
Forks
2k
Avg merge
4d 20h
Merged PRs (30d)
71

Description

## Bug Report

**Describe the bug**

geoip2 always process logs, regardless if `lookup_key` exist or not. It always adds empty/nil geoip fields to log lines.

**To Reproduce**

Add geoip2 filter and send a log without 'lookup_key'. Example config:

```
[INPUT]
Name dummy
Tag dummytag
Dummy {"any_key": "any_value"}

[FILTER]
Name geoip2
Match dummytag
Database /geoip/GeoLite2-City.mmdb
Lookup_key remote_addr
Record country remote_addr %{country.names.en}
Record isocode remote_addr %{country.iso_code}

[OUTPUT]
Name stdout
Match dummytag
```

Output:

```
[0] dummytag: [[1691872691.252361439, {}], {"any_key"=>"any_value", "country"=>nil, "isocode"=>nil}]
```

**Expected behavior**

Ignore the log line if `lookup_key` doesn't exist. Are there really reasons to process the log, if no `lookup_key` exist?

Expected output:

```
[0] dummytag: [[1691872691.252361439, {}], {"any_key"=>"any_value"}]
```

**Your Environment**

fluent-bit 2.1.8

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.