diff --git a/plugins/in_tail/tail_fs_stat.c b/plugins/in_tail/tail_fs_stat.c index 1141af6856a..c5adfd74a92 100644 --- a/plugins/in_tail/tail_fs_stat.c +++ b/plugins/in_tail/tail_fs_stat.c @@ -93,6 +93,9 @@ static int tail_fs_check(struct flb_input_instance *ins, struct flb_tail_file *file = NULL; struct fs_stat *fst; struct stat st; + int pending_data_detected; + + pending_data_detected = FLB_FALSE; /* Lookup watched file */ mk_list_foreach_safe(head, tmp, &ctx->files_event) { @@ -142,7 +145,7 @@ static int tail_fs_check(struct flb_input_instance *ins, if (file->offset < st.st_size) { file->pending_bytes = (st.st_size - file->offset); - tail_signal_pending(ctx); + pending_data_detected = FLB_TRUE; } else { file->pending_bytes = 0; @@ -173,6 +176,10 @@ static int tail_fs_check(struct flb_input_instance *ins, } + if (pending_data_detected) { + tail_signal_pending(ctx); + } + return 0; }