Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions plugins/in_tail/tail_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ static inline int flb_tail_target_file_name_cmp(char *name,

base_b = basename(name_b);
ret = _stricmp(base_a, base_b);

/*
* Fallback: when monitoring symlinks the DB stores the symlink path
* (file->name) while real_name resolves to the target. Compare
* against the original path so the entry is still recognised.
*/
if (ret != 0 && file->name) {
flb_free(name_b);
name_b = flb_strdup(file->name);
if (name_b) {
base_b = basename(name_b);
ret = _stricmp(base_a, base_b);
}
Comment thread
zdyj3170101136 marked this conversation as resolved.
}
Comment thread
zdyj3170101136 marked this conversation as resolved.
#else
name_b = flb_strdup(file->real_name);
if (!name_b) {
Expand All @@ -103,6 +117,20 @@ static inline int flb_tail_target_file_name_cmp(char *name,
}
base_b = basename(name_b);
ret = strcmp(base_a, base_b);

/*
* Fallback: when monitoring symlinks the DB stores the symlink path
* (file->name) while real_name resolves to the target. Compare
* against the original path so the entry is still recognised.
*/
if (ret != 0 && file->name) {
flb_free(name_b);
name_b = flb_strdup(file->name);
if (name_b) {
base_b = basename(name_b);
ret = strcmp(base_a, base_b);
Comment thread
zdyj3170101136 marked this conversation as resolved.
}
}
#endif

out:
Expand Down
Loading