File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,20 @@ static int tail_fs_check(struct flb_input_instance *ins,
161161 file -> pending_bytes = 0 ;
162162 }
163163
164+ /*
165+ * Skip rotation detection when keep_file_handle is false.
166+ * Rotation detection requires persistent open handles to work reliably.
167+ * Without keeping handles open, calling flb_tail_file_name() would
168+ * unnecessarily open and close handles multiple times per check cycle.
169+ * Because we are not keeping a handle, a rotation would be interpreted
170+ * as a truncation and handled by the truncation management logic.
171+ */
172+ if (ctx -> keep_file_handle == FLB_FALSE ) {
173+ flb_plg_debug (ctx -> ins , "tail_fs_check: skipping rotation detection for %s (keep_file_handle is false)" ,
174+ file -> name );
175+ continue ;
176+ }
177+
164178 /* Discover the current file name for the open file descriptor */
165179 name = flb_tail_file_name (file );
166180 if (!name ) {
You can’t perform that action at this time.
0 commit comments