Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting a key under an existing key results in duplicate keys #1177

Closed
robinkb opened this issue Mar 7, 2019 · 4 comments
Closed

Nesting a key under an existing key results in duplicate keys #1177

robinkb opened this issue Mar 7, 2019 · 4 comments
Assignees

Comments

@robinkb
Copy link

robinkb commented Mar 7, 2019

Bug Report

Describe the bug

Attempting to nest a key under a key that already exists results in duplicate keys.
Elasticsearch does not accept duplicate keys, meaning that the record cannot be indexed.

To Reproduce

fluent-bit configuration to reproduce the problem:

[SERVICE]
    Flush        5
    Daemon       Off
    Config_Watch On

[INPUT]
    Name  dummy
    Tag   dummy
    Dummy {"key": "value", "nested": {"other_key": "value"}}

[FILTER]
    Name       nest
    Match      dummy
    Operation  nest
    Wildcard   key
    Nest_under nested

[OUTPUT]
    Name  stdout
    Match dummy

This results in the following data structure, as logged through stdout:

[0] dummy: [1551985434.000610724, {"nested"=>{"other_key"=>"value"}, "nested"=>{"key"=>"value"}}]

Expected behavior

No duplicate keys appear, resulting in the following data structure:

{"nested"=>{"other_key"=>"value","key"=>"value"}}

Your Environment

  • Version used: 1.0.4

See the configuration snippet above.

Additional context

Because fluent-bit generates a data structure with duplicate keys, I cannot index some logs in Elasticsearch.

@fhoy
Copy link

fhoy commented Mar 8, 2019

This seems similar to the situation described in https://groups.google.com/d/msg/fluent-bit/bTEewmXEKFM/AM1zLr-VBgAJ.

@edsiper
Copy link
Member

edsiper commented Mar 8, 2019

cc: @michiel

@michiel
Copy link
Contributor

michiel commented Mar 13, 2019

@fhoy, @edsiper This observation is correct - the nest filter currently does not nest into an existing map, only into a new one.

@edsiper
Copy link
Member

edsiper commented Sep 30, 2020

FYI: I pushed fix 1d14886 to handle duplicated keys for plugins that converts data back to JSON

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

No branches or pull requests

4 participants