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

logfmt: bare keys get "true" as value, not "nil" #6099

Merged
merged 1 commit into from
Oct 15, 2022

Conversation

seveas
Copy link
Contributor

@seveas seveas commented Sep 26, 2022

In #4359, @nokute78 notes that bare keys in logfmt lines get the wrong
value after parsing: they should get a true value, not nil.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@seveas
Copy link
Contributor Author

seveas commented Sep 26, 2022

Test logline:

foo=bar baz=quux plonk1 plonk2 last_plonk

Old output

[0] tail.0: [1664193795.762467000, {"foo"=>"bar", "baz"=>"quux", "plonk1"=>nil, "plonk2"=>nil}]

New output

[0] tail.0: [1664194341.064513000, {"foo"=>"bar", "baz"=>"quux", "plonk1"=>true, "plonk2"=>true}]

(last_plonk is still missing from the output, #4359 will fix that)

In fluent#4359, @nokute78 notes that bare keys in logfmt lines get the wrong
value after parsing: they should get a `true` value, not `nil`.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
@seveas seveas temporarily deployed to pr September 30, 2022 21:26 Inactive
@seveas seveas temporarily deployed to pr September 30, 2022 21:26 Inactive
@seveas seveas temporarily deployed to pr September 30, 2022 21:44 Inactive
@nokute78 nokute78 changed the title logfmt: bare keys get true as value, not nil logfmt: bare keys get "true" as value, not "nil" Sep 30, 2022
Copy link
Collaborator

@nokute78 nokute78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Note: I modified PR title to pass CI.

Note: I referred to following document.
https://pkg.go.dev/github.com/kr/logfmt#pkg-overview

Example logfmt message:
foo=bar a=14 baz="hello kitty" cool%story=bro f %^asdf

Example result in JSON:
{ "foo": "bar", "a": 14, "baz": "hello kitty", "cool%story": "bro", "f": true, "%^asdf": true }

@edsiper edsiper merged commit 00c54dc into fluent:master Oct 15, 2022
@edsiper
Copy link
Member

edsiper commented Oct 15, 2022

thansk!

mgeriesa pushed a commit to mgeriesa/fluent-bit that referenced this pull request Oct 25, 2022
In fluent#4359, @nokute78 notes that bare keys in logfmt lines get the wrong
value after parsing: they should get a `true` value, not `nil`.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Manal Geries <mgeriesa@gmail.com>
sumitd2 pushed a commit to sumitd2/fluent-bit that referenced this pull request Feb 8, 2023
In fluent#4359, @nokute78 notes that bare keys in logfmt lines get the wrong
value after parsing: they should get a `true` value, not `nil`.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: root <root@sumit-acs.novalocal>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants