Skip to content

Add 'ignore_unavailable' config option to in_tail plugin#12097

Open
ner216 wants to merge 5 commits into
fluent:masterfrom
ner216:add-ignore-missing-tail-paths
Open

Add 'ignore_unavailable' config option to in_tail plugin#12097
ner216 wants to merge 5 commits into
fluent:masterfrom
ner216:add-ignore-missing-tail-paths

Conversation

@ner216

@ner216 ner216 commented Jul 14, 2026

Copy link
Copy Markdown

Omit output regarding scanning of directories that do not exist.

Fixes #11964

This PR adds a boolean config option to the in_tail plugin called "ignore_unavailable". This option will make Fluent-bit omit log output regarding failure to scan paths that do not exist.

The use case for this PR is if you would like to use the same config across different systems/environments where certain log files may or may not exist. In this case, this option will reduce unnecessary error messages generated by missing log files/paths.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Config file for change:

[SERVICE]
    Flush        1
    Daemon       Off
    Log_Level    info

[INPUT]
    Name           tail
    Tag            test.log
    Path           /path/to/nowhere/*,/var/log/app/*
    Read_from_Head true
    Refresh_Interval 1
    Ignore_Unavailable true

[OUTPUT]
    Name   stdout
    Match  *

Output with Ignore_Unavailable set to false:

[2026/07/13 21:18:01.876] [ info] [fluent bit] version=5.0.9, commit=03fca836ef, pid=70889
[2026/07/13 21:18:01.876] [ info] [storage] ver=1.5.4, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2026/07/13 21:18:01.876] [ info] [simd    ] SSE2
[2026/07/13 21:18:01.876] [ info] [cmetrics] version=2.1.5
[2026/07/13 21:18:01.876] [ info] [ctraces ] version=0.7.1
[2026/07/13 21:18:01.876] [ info] [input:tail:tail.0] initializing
[2026/07/13 21:18:01.876] [ info] [input:tail:tail.0] storage_strategy='memory' (memory only)
[2026/07/13 21:18:01.877] [ warn] [input:tail:tail.0] No such file at path: /path/to/nowhere/*
[2026/07/13 21:18:01.877] [error] [input:tail:tail.0] Not directory at path: /path/to/nowhere/*
[2026/07/13 21:18:01.877] [error] [input:tail:tail.0] Unable to read path: /path/to/nowhere/*
[2026/07/13 21:18:01.877] [ warn] [input:tail:tail.0] error scanning path: /path/to/nowhere/*
[2026/07/13 21:18:01.877] [ warn] [input:tail:tail.0] No such file at path: /var/log/app/*
[2026/07/13 21:18:01.877] [error] [input:tail:tail.0] Not directory at path: /var/log/app/*
[2026/07/13 21:18:01.877] [error] [input:tail:tail.0] Unable to read path: /var/log/app/*
[2026/07/13 21:18:01.877] [ warn] [input:tail:tail.0] error scanning path: /var/log/app/*

Output with Ignore_Unavailable set to true:

[2026/07/13 21:19:05.141] [ info] [fluent bit] version=5.0.9, commit=03fca836ef, pid=70934
[2026/07/13 21:19:05.141] [ info] [storage] ver=1.5.4, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2026/07/13 21:19:05.141] [ info] [simd    ] SSE2
[2026/07/13 21:19:05.141] [ info] [cmetrics] version=2.1.5
[2026/07/13 21:19:05.141] [ info] [ctraces ] version=0.7.1
[2026/07/13 21:19:05.141] [ info] [input:tail:tail.0] initializing
[2026/07/13 21:19:05.141] [ info] [input:tail:tail.0] storage_strategy='memory' (memory only)
[2026/07/13 21:19:05.142] [ info] [sp] stream processor started
[2026/07/13 21:19:05.142] [ info] [engine] Shutdown Grace Period=5, Shutdown Input Grace Period=2
[2026/07/13 21:19:05.142] [ info] [output:stdout:stdout.0] worker #0 started

Valgrind output:

==70643== HEAP SUMMARY:
==70643==     in use at exit: 0 bytes in 0 blocks
==70643==   total heap usage: 2,522 allocs, 2,522 frees, 532,923 bytes allocated
==70643== 
==70643== All heap blocks were freed -- no leaks are possible
==70643== 
==70643== For lists of detected and suppressed errors, rerun with: -s
==70643== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [ N/A] Run local packaging test showing all targets (including any new ones) build.
  • [ N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [Yes ] Documentation required for this feature
  • I will create a PR for this

Backporting

  • [ If desired] Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • New Features
    • Added an ignore_unavailable option to the Tail input (boolean, default: false) to skip non-existent/unavailable directories when matching files.
  • Bug Fixes
    • Improved Tail scan error reporting with clearer messages for permission issues and missing paths.
    • Updated behavior so unavailable paths only produce “error scanning path” warnings when ignore_unavailable is disabled.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Tail input adds the ignore_unavailable boolean option and applies it to path-scan warning and glob error handling, including distinct messages for permission, missing-path, and non-directory errors.

Changes

Tail unavailable-path handling

Layer / File(s) Summary
Configure ignore_unavailable
plugins/in_tail/tail.c, plugins/in_tail/tail_config.h
Adds the boolean configuration option with a default of false and stores it in flb_tail_config.
Conditionally handle scan errors
plugins/in_tail/tail_scan.c, plugins/in_tail/tail_scan_glob.c
Suppresses scan warnings when enabled and differentiates permission, missing-path, non-directory, and other glob read errors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: cosmo0920, edsiper

Sequence Diagram(s)

sequenceDiagram
  participant flb_tail_scan
  participant tail_scan_path
  participant do_glob
  flb_tail_scan->>tail_scan_path: scan configured path
  tail_scan_path->>do_glob: expand path glob
  do_glob-->>tail_scan_path: return scan result and errno
  tail_scan_path-->>flb_tail_scan: emit or suppress warning using ignore_unavailable
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change to the in_tail plugin.
Linked Issues check ✅ Passed The new option suppresses errors for missing or unavailable paths while preserving default behavior.
Out of Scope Changes check ✅ Passed The changes stay focused on the new Tail input option and related scan handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/in_tail/tail_scan_glob.c`:
- Around line 217-225: Add break statements to each handled branch of the errno
switch in tail scan error handling, including ENOENT and ENOTDIR, so each errno
logs only its corresponding message and does not fall through to subsequent
cases or default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b27d1d09-1cd5-4335-b53e-8a57b4d5eacb

📥 Commits

Reviewing files that changed from the base of the PR and between 2cec2cb and 74844a2.

📒 Files selected for processing (4)
  • plugins/in_tail/tail.c
  • plugins/in_tail/tail_config.h
  • plugins/in_tail/tail_scan.c
  • plugins/in_tail/tail_scan_glob.c

Comment thread plugins/in_tail/tail_scan_glob.c Outdated
@ner216 ner216 force-pushed the add-ignore-missing-tail-paths branch from 74844a2 to 892e771 Compare July 14, 2026 01:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74844a2974

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread plugins/in_tail/tail_scan_glob.c Outdated
flb_plg_error(ctx->ins, "read error, check permissions: %s", path);
if (errno == EACCES) {
flb_plg_error(ctx->ins, "NO read access for path: %s", path);
} else if (!ctx->ignore_unavailable) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve diagnostics for non-missing glob aborts

When Ignore_Unavailable is true, this branch suppresses every GLOB_ABORTED errno except EACCES; for example a path that hits a symlink loop (ELOOP) or another real read failure becomes silent because flb_tail_scan() also skips the summary warning under this flag. The option is documented as ignoring paths/directories that do not exist, so only missing/unavailable path errnos such as ENOENT/ENOTDIR should be silenced while other glob aborts continue to log.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/in_tail/tail_config.h`:
- Line 91: Update the comment for the ignore_unavailable field in tail_config.h
to describe ignoring unavailable paths, including missing files, directories,
and glob targets, rather than referring only to directory paths. Keep the field
and behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a88cf8d0-d0fe-4f4b-9ff6-4c543678e841

📥 Commits

Reviewing files that changed from the base of the PR and between 74844a2 and 892e771.

📒 Files selected for processing (4)
  • plugins/in_tail/tail.c
  • plugins/in_tail/tail_config.h
  • plugins/in_tail/tail_scan.c
  • plugins/in_tail/tail_scan_glob.c
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/in_tail/tail_scan.c
  • plugins/in_tail/tail.c
  • plugins/in_tail/tail_scan_glob.c

Comment thread plugins/in_tail/tail_config.h Outdated
ner216 added 4 commits July 14, 2026 18:24
…regular scan of directories that do not exist/not found.

Signed-off-by: ner216 <provencher.nolan@gmail.com>
…te logic to retain permision errors.

Signed-off-by: ner216 <provencher.nolan@gmail.com>
Signed-off-by: ner216 <provencher.nolan@gmail.com>
Signed-off-by: ner216 <provencher.nolan@gmail.com>
Signed-off-by: ner216 <provencher.nolan@gmail.com>
@ner216 ner216 force-pushed the add-ignore-missing-tail-paths branch from 064239f to bebe503 Compare July 14, 2026 22:33
@ner216

ner216 commented Jul 14, 2026

Copy link
Copy Markdown
Author

I just created a companion documentation PR at fluent/fluent-bit-docs#2626. I adjusted the code to not omit errors unrelated to the purpose of the config option as pointed out by the Codex review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ignore_missing_path option to Tail input for optional log file globs

1 participant