Skip to content

fix(fluentbit): render timeKeep of the LTSV parser as Time_Keep - #2123

Open
lbarrosby wants to merge 1 commit into
fluent:masterfrom
lbarrosby:fix-fluentbit-ltsv-time-keep
Open

lbarrosby wants to merge 1 commit into
fluent:masterfrom
lbarrosby:fix-fluentbit-ltsv-time-keep

Conversation

@lbarrosby

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The Fluent Bit LTSV parser (LSTV.Params) rendered timeKeep under the wrong key:

if l.TimeKeep != nil {
	kvs.Insert("Time_Format", fmt.Sprint(*l.TimeKeep))
}

A ClusterParser / Parser with ltsv: {timeFormat: "%d/%b/%Y:%H:%M:%S %z", timeKeep: true} produced a second Time_Format true line instead of Time_Keep true. Fluent Bit then uses true as the time format, so the time of every record fails to parse, and Time_Keep is never set. The JSON, logfmt and regex parsers already use Time_Keep; this makes LTSV do the same.

Tests:

  • New TestParsers_TimeKeep covers the four parsers with timeFormat and timeKeep: true. On master the ltsv case fails.
  • go test ./apis/... passes, golangci-lint run on the package reports no issues.

Which issue(s) this PR fixes:

None, found while reading the code.

Does this PR introduced a user-facing change?

Fix the Fluent Bit LTSV parser rendering `timeKeep` as `Time_Format` instead of `Time_Keep`.

Additional documentation, usage docs, etc.:


The LTSV parser wrote timeKeep as a second Time_Format entry, so
timeKeep: true rendered "Time_Format true". Fluent Bit then used "true"
as the time format, records failed to parse their time, and Time_Keep
was never set.

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant