Skip to content

Commit

Permalink
Merge branch 'master' into leonardo-master-filesystem-access-abstract…
Browse files Browse the repository at this point in the history
…ion-later

Signed-off-by: leonardo-albertovich <[email protected]>
  • Loading branch information
leonardo-albertovich authored Oct 5, 2023
2 parents e2e6175 + 92e0435 commit d160ab9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
13 changes: 10 additions & 3 deletions plugins/in_tail/tail.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,28 @@ static int in_tail_collect_pending(struct flb_input_instance *ins,
mk_list_foreach_safe(head, tmp, &ctx->files_event) {
file = mk_list_entry(head, struct flb_tail_file, _head);

if (file->watch_fd == -1) {
if (file->watch_fd == -1 ||
(file->offset >= file->size)) {
/* Gather current file size */
ret = flb_file_fstat(file->fd, &st);

if (ret == -1) {
flb_errno();
flb_tail_file_remove(file);
continue;
}

file->size = st.size;
file->pending_bytes = (file->size - file->offset);
}
else {
memset(&st, 0, sizeof(struct flb_file_stat));
}

if (file->pending_bytes <= 0) {
file->pending_bytes = (file->size - file->offset);
}

if (file->pending_bytes <= 0) {
continue;
}
Expand Down Expand Up @@ -121,8 +128,8 @@ static int in_tail_collect_pending(struct flb_input_instance *ins,
* Adjust counter to verify if we need a further read(2) later.
* For more details refer to tail_fs_inotify.c:96.
*/
if (file->offset < st.size) {
file->pending_bytes = (st.size - file->offset);
if (file->offset < file->size) {
file->pending_bytes = (file->size - file->offset);
active++;
}
else {
Expand Down
20 changes: 0 additions & 20 deletions plugins/in_tail/tail_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,12 +1669,8 @@ static int check_purge_deleted_file(struct flb_tail_config *ctx,
struct flb_tail_file *file, time_t ts)
{
int ret;
<<<<<<< HEAD
int64_t mtime;
struct flb_file_stat st;
=======
struct stat st;
>>>>>>> 3ab27eff5 (in_tail: removed ignore_older enforcement on files that are being ingested)

ret = flb_file_fstat(file->fd, &st);
if (ret == -1) {
Expand All @@ -1697,22 +1693,6 @@ static int check_purge_deleted_file(struct flb_tail_config *ctx,
return FLB_TRUE;
}

<<<<<<< HEAD
if (ctx->ignore_older > 0) {
mtime = st.modification_time;

if (mtime > 0) {
if ((ts - ctx->ignore_older) > mtime) {
flb_plg_debug(ctx->ins, "purge: monitored file (ignore older): %s",
file->name);
flb_tail_file_remove(file);
return FLB_TRUE;
}
}
}

=======
>>>>>>> 3ab27eff5 (in_tail: removed ignore_older enforcement on files that are being ingested)
return FLB_FALSE;
}

Expand Down

0 comments on commit d160ab9

Please sign in to comment.