Skip to content

Flush on container termination (but actually on inotify CLOSE_WRITE)#4

Merged
solsson merged 3 commits into
mainfrom
flush-on-container-termination-nay-inotify-close-write
Mar 10, 2026
Merged

Flush on container termination (but actually on inotify CLOSE_WRITE)#4
solsson merged 3 commits into
mainfrom
flush-on-container-termination-nay-inotify-close-write

Conversation

@solsson
Copy link
Copy Markdown
Contributor

@solsson solsson commented Mar 10, 2026

Followup to #3. If we buffer logs for extended periods of time we should not have a gap after pod termination where kubectl logs doesn't work and we still haven't flushed to blobs.

solsson and others added 3 commits March 10, 2026 11:18
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>
@solsson solsson merged commit 8d641f8 into main Mar 10, 2026
1 check passed
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