Skip to content

Commit

Permalink
in_tail: add file name context to inotify debug event mask
Browse files Browse the repository at this point in the history
These messages are useful for debugging except with only
the inode, it you have to do work to match this with
specific files.

Signed-off-by: Wesley Pettit <[email protected]>
  • Loading branch information
PettitWesley committed Mar 7, 2023
1 parent 7bcb502 commit ab11d1d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions plugins/in_tail/tail_fs_inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,30 @@ static int debug_event_mask(struct flb_tail_config *ctx,
uint32_t mask)
{
flb_sds_t buf;
int buf_size = 256;

/* Only enter this function if debug mode is allowed */
if (flb_log_check(FLB_LOG_DEBUG) == 0) {
return 0;
}

if (file) {
buf_size = file->name_len + 128;
}

if (buf_size < 256) {
buf_size = 256;
}

/* Create buffer */
buf = flb_sds_create_size(256);
buf = flb_sds_create_size(buf_size);
if (!buf) {
return -1;
}

/* Print info into sds */
if (file) {
flb_sds_printf(&buf, "inode=%"PRIu64" events: ", file->inode);
flb_sds_printf(&buf, "inode=%"PRIu64", %s, events: ", file->name, file->inode);
}
else {
flb_sds_printf(&buf, "events: ");
Expand Down

0 comments on commit ab11d1d

Please sign in to comment.