fluent-bit-docs icon indicating copy to clipboard operation
fluent-bit-docs copied to clipboard

Doc Enhancement: copytruncate and Log Loss Risk

Open hardikkhurana opened this issue 6 months ago • 2 comments

Fluent Bit documentation to explicitly warn users about potential log loss when using logrotate's copytruncate mode.

While we note that file rotation is handled, the docs don't address the risks inherent to copytruncate, specifically:

  1. Race conditions: Logs can be lost in the brief window between copying and truncating the file.

  2. Fluent Bit backpressure: If FLB is under backpressure, logs might be dropped if copytruncate occurs before they can be processed and sent.

Referencing the logrotate man page: "Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost." This crucial detail should be included in our documentation.

Even FileBeat's Documentation has a page on it - https://www.elastic.co/docs/reference/beats/filebeat/file-log-rotation

hardikkhurana avatar Jun 22 '25 09:06 hardikkhurana

@hardikkhurana do you mean the docs page for tail (see bottom) as the entry point for a warning?

eschabell avatar Jun 26 '25 13:06 eschabell

@eschabell Yes, that sounds like a good place for it! The tail plugin's documentation is where users configuring log ingestion would typically look, making it an ideal spot to highlight the copytruncate risks.

"File rotation is properly handled, including logrotate's copytruncate mode." -> seems misleading.

hardikkhurana avatar Jun 28 '25 10:06 hardikkhurana