Repository navigation
Conversation
tests/fluentbit-record.test.mjs evaluates the fields of each Fluent Bit output and of the process output example with stubs of the engine functions they call, for an event with a timestamp and one without, and parses each record as Fluent Bit's stdin input reads it. It also checks that the stdin input's buffer holds records larger than Fluent Bit's 16k default. On main 8 of the 15 tests fail: the seven records of an event with no timestamp, and the buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ach Fluent Bit
The Fluent Bit outputs and the process output example write each event as
[ <time> , {...} ]. dateFormat("+%s.%N") writes nothing for an event with no
timestamp, so its record was [ , {...} ], which Fluent Bit's stdin input
discards together with every other record of the same read. The time field
is now timestamped ? dateFormat("+%s.%N") : now() / 1000: such an event
carries the second it is written. Events with a timestamp are written as
before, byte for byte.
The stdin input now reads with a 16M buffer. With the default 16k, a record
that does not fit leaves no room for the next read, Fluent Bit 5.1.5 takes
the 0-byte read as the end of its input and shuts down, and that record and
every later one are not sent.
The config test workflow also runs when these files change.
Checked with Fluent Bit 5.1.5 (Splunk output to a stand-in HEC, engine
1.1.153 on the JVM, stdin input, Receiver app, the Splunk file with the fix
of #120). OpenTelemetry sample, 5,000 lines (3,723 events, 637 with no
timestamp): the shipped files delivered 0 of 470 records written before
Fluent Bit stopped; the 16M buffer alone 2,986 of 3,723; both changes 3,723
of 3,723, every record valid, the 5,000 lines back at the HEC. Windows
Security 662 and CloudTrail 8,100: the bytes written to Fluent Bit are
identical to the shipped fields', every event delivered. node --test tests/:
30 of 30.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every event the Fluent Bit outputs write now reaches Fluent Bit as a valid record and is sent, including events with no timestamp and events larger than 16 KB. Two changes, both in this repository:
pipelines/run/output/event/fluentbit/*.yaml) and the process output example write each event as[ <time> , {"text":...} ], the form Fluent Bit's stdin input reads. The time came fromdateFormat("+%s.%N"), which writes nothing for an event with no timestamp, so the record was[ , {...} ]. That is not JSON, and Fluent Bit's stdin input discards it together with every other record in the same read. The time field is nowtimestamped ? dateFormat("+%s.%N") : now() / 1000: an event with no timestamp carries the second it is written, as Fluent Bit itself times a record that has none with the time it reads it. Events with a timestamp are written as before, byte for byte.fluentbit-10x-input.confnow setsBuffer_Size 16Mon the stdin input. With the default 16k, a record that does not fit fills the buffer, the next read asks for 0 bytes, Fluent Bit 5.1.5 takes the 0 as the end of its input and shuts down, and that record and every record after it are not sent. A multi-line event (a stack trace, a group of JSON lines) is often larger than 16 KB.The config test workflow also runs when these files change.
Checked
Fluent Bit 5.1.5 in a container, the engine 1.1.153 on the JVM as the Receiver with stdin input, Fluent Bit's Splunk output over TLS to a stand-in HEC that stores every request. The Splunk file used is
splunk.yamlwith the fix of #120 (the shipped file stops Fluent Bit at startup), with and without this change; the bytes the engine wrote to Fluent Bit's stdin were copied to a file.On the OpenTelemetry sample, 3,083 of the 3,086 records with a timestamp are byte-identical to the shipped fields'. The other 3 carry only a time of day (
20:12:46.393), which the engine dates by the clock of the run; the two runs were on either side of 20:12 UTC, so those 3 differ by exactly one day, with or without this change.node --test tests/: 30 of 30. The newtests/fluentbit-record.test.mjsevaluates each output's fields with stubs of the engine functions and parses the record as Fluent Bit reads it; onmain8 of its 15 tests fail.Not changed
+%s.%Nof the engine's epoch, which is<seconds>.0for a millisecond timestamp (the milliseconds are not sent) and has no leading zeros in the fraction for a nanosecond timestamp (41.022663733is sent as41.22663733). That is in the engine's formatter and is not changed here.🤖 Generated with Claude Code