Skip to content

Commit 892e771

Browse files
committed
Rename config option ignore_missing_paths to ignore_unavailable. Update logic to retain permision errors.
Signed-off-by: ner216 <provencher.nolan@gmail.com>
1 parent 61afa70 commit 892e771

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

plugins/in_tail/tail.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ static struct flb_config_map config_map[] = {
577577
"files matching a certain criteria, e.g: 'exclude_path *.gz,*.zip'"
578578
},
579579
{
580-
FLB_CONFIG_MAP_BOOL, "ignore_missing_paths", "false",
581-
0, FLB_TRUE, offsetof(struct flb_tail_config, ignore_missing_paths),
580+
FLB_CONFIG_MAP_BOOL, "ignore_unavailable", "false",
581+
0, FLB_TRUE, offsetof(struct flb_tail_config, ignore_unavailable),
582582
"Do not search directories that do not exist for files."
583583
},
584584
{

plugins/in_tail/tail_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct flb_tail_config {
8888
long refresh_interval_nsec;/* nanoseconds to re-scan */
8989
int read_newly_discovered_files_from_head; /* read new files from head after startup */
9090
int read_from_head; /* read new files from head */
91-
int ignore_missing_paths; /* Ignore directory paths that do not exist */
91+
int ignore_unavailable; /* Ignore directory paths that do not exist */
9292
int rotate_wait; /* sec to wait on rotated files */
9393
int watcher_interval; /* watcher interval */
9494
int ignore_older; /* ignore fields older than X seconds */

plugins/in_tail/tail_scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int flb_tail_scan(struct mk_list *path_list, struct flb_tail_config *ctx)
114114
flb_plg_debug(ctx->ins, "%i new files found on path '%s'",
115115
ret, pattern->str);
116116
}
117-
else if (!ctx->ignore_missing_paths) {
117+
else if (!ctx->ignore_unavailable) {
118118
flb_plg_warn(ctx->ins, "error scanning path: %s", pattern->str);
119119
}
120120
}

plugins/in_tail/tail_scan_glob.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ static inline int do_glob(const char *pattern, int flags,
183183
return ret;
184184
}
185185

186-
187186
/* Scan a path, register the entries and return how many */
188187
static int tail_scan_path(const char *path, struct flb_tail_config *ctx)
189188
{
@@ -212,16 +211,23 @@ static int tail_scan_path(const char *path, struct flb_tail_config *ctx)
212211
flb_plg_error(ctx->ins, "no memory space available");
213212
return -1;
214213
case GLOB_ABORTED:
215-
if (!ctx->ignore_missing_paths) {
216-
flb_plg_error(ctx->ins, "read error, check permissions: %s", path);
214+
if (errno == EACCES) {
215+
flb_plg_error(ctx->ins, "NO read access for path: %s", path);
216+
} else if (!ctx->ignore_unavailable) {
217+
switch (errno) {
218+
case ENOENT:
219+
flb_plg_warn(ctx->ins, "No such file at path: %s", path);
220+
case ENOTDIR:
221+
flb_plg_error(ctx->ins, "Not directory at path: %s", path);
222+
default:
223+
flb_plg_error(ctx->ins, "Unable to read path: %s", path);
224+
}
217225
}
218226
return -1;
219227
case GLOB_NOMATCH:
220228
ret = stat(path, &st);
221229
if (ret == -1) {
222-
if (!ctx->ignore_missing_paths) {
223-
flb_plg_debug(ctx->ins, "cannot read info from: %s", path);
224-
}
230+
flb_plg_debug(ctx->ins, "cannot read info from: %s", path);
225231
}
226232
else {
227233
ret = access(path, R_OK);

0 commit comments

Comments
 (0)