Skip to content

Fluent Bit outputs: events with no timestamp and events over 16 KB reach Fluent Bit - #122

Draft
talwgx wants to merge 2 commits into
mainfrom
fix/fluentbit-output-records
Draft

talwgx wants to merge 2 commits into
mainfrom
fix/fluentbit-output-records

Conversation

@talwgx

@talwgx talwgx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

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:

  • Events with no timestamp. The Fluent Bit outputs (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 from dateFormat("+%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 now timestamped ? 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.
  • Records larger than 16 KB. fluentbit-10x-input.conf now sets Buffer_Size 16M on 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.yaml with 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.

records written with no time delivered to the HEC
OpenTelemetry sample, 5,000 lines (3,723 events), shipped files 470 (then Fluent Bit stopped reading and the engine stopped writing) 282 0
same, 16M buffer only 3,723 637 2,986
same, time fallback only (an engine build that applies it), 16k buffer 470, all valid 0 68: Fluent Bit stopped at record 69, the first over 16 KB (71,777 bytes the largest)
same, this change 3,723, all valid 0 3,723; the 5,000 input lines come back at the HEC
Windows Security, 662 events 662, byte-identical to the shipped fields' 0 662
CloudTrail, 8,100 events 8,100, byte-identical to the shipped fields' 0 8,100

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 new tests/fluentbit-record.test.mjs evaluates each output's fields with stubs of the engine functions and parses the record as Fluent Bit reads it; on main 8 of its 15 tests fail.

Not changed

  • Events with a timestamp: their time is written as before. That time is +%s.%N of the engine's epoch, which is <seconds>.0 for a millisecond timestamp (the milliseconds are not sent) and has no leading zeros in the fraction for a nanosecond timestamp (41.022663733 is sent as 41.22663733). That is in the engine's formatter and is not changed here.
  • Records still follow each other with no newline between them; Fluent Bit's stdin input reads them that way.

🤖 Generated with Claude Code

talwgx and others added 2 commits November 14, 2026 15:30
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

No deployments
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