Repository navigation
Conversation
Keep file reads ordered within each container attempt, with stable per-stream merge keys across kubelet rotation. Confirm discovery before consuming new sequences and drain predecessors after their writers close. AI-assisted implementation and tests: OpenAI Codex (GPT-6).
|
Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement. To sign, copy and post the phrase below as a new comment on this PR.
I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
Summary
A partial container log message can span kubelet-rotated files. Grouping by filename separates its fragments, and independently polling the files can deliver the ending before the beginning. Read each container attempt’s files in order and merge its fragments across rotations, keeping stdout, stderr, and container restarts separate. With
oldest_first: false, each attempt shares read time with the other attempts.Newly discovered sequences receive a confirming scan before consumption. On Linux, a short-lived read lease checks that a predecessor’s writer has closed; late bytes are drained before advancing. If that check is unavailable, the reader warns and falls back to EOF-based ordering. A writer that remains open delays newer files for its attempt. These completion and portability tradeoffs need maintainer review.
The first commit preserves the stream-separation contribution from #26566, including its original authorship. The rotation implementation is a separate commit, with one compatibility adjustment from the deprecated
Value::as_straccessor toValue::to_str_lossy. The independent allocation optimization in #26516 is not included.References
Closes #24981.
Related: #26566 and #25385. The regression coverage targets kubelet timestamp-named rotations; Docker symlink behavior in #25385 is not claimed as fixed.
Vector configuration
The affected source is
kubernetes_logswith automatic partial merging enabled. No new configuration fields are introduced. The fairness tests useoldest_first: false; the existing default and priority option are retained.How did you test this PR?
Validation is against current upstream master with Rust 1.100.0.
FEATURES=sources-kubernetes_logs,sources-file make check-clippypasses on Linux.make fmt,make check-markdown, andmake check-changelog-fragmentspass.The regression cases cover cross-file merging in both log namespaces, restart/stream isolation, ordering during discovery, a rename between listing and opening, late predecessor writes after EOF, final unterminated bytes, and continued progress for unrelated containers. The new cross-file merger regression fails before the rotation change (two records instead of one) and passes after it.
An earlier 0.61 downstream implementation also passed replay and live kubelet rotation with 13 MiB and 50 MiB messages, matching the expected hashes and surrounding record order. All 60 control messages arrived, including 36 before the large record completed. That runtime build also carried the separate allocation fix from #26516; those measurements are supporting evidence for this port.
Does this PR include user facing changes?