Flush on container termination (but actually on inotify CLOSE_WRITE)#4
Merged
solsson merged 3 commits intoMar 10, 2026
Merged
Conversation
Patches fluent-bit's tail_fs_inotify.c to watch IN_CLOSE_WRITE events. When CRI closes a container log file, a sentinel record on tag._close triggers the S3 output to force-flush buffered data for that tag. Adds e2e tests for exit 0, exit 1, and kubectl delete pod scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increases upload_timeout to 60s to clearly separate flush triggers: - 7h: size-based (>1M burst via yes|head, appears in <45s) - 7i: timeout-based (small data, NOT in S3 at 20s, IS after ~88s) - 7j/7k: SIGTERM (shutdown handler flushes buffers) - 7l: close-write (container exits, appears in <30s without killing fluentbit) Adds Buffer_Chunk_Size=512K and Buffer_Max_Size=2M to tail input so size-based flush can accumulate >1M within a few engine cycles. Drops redundant exit-1 close-write test (same CRI behavior as exit-0). Fixes corrupt patch file (wrong context lines for v4.2.2 source). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Followup to #3. If we buffer logs for extended periods of time we should not have a gap after pod termination where
kubectl logsdoesn't work and we still haven't flushed to blobs.