Add 'ignore_unavailable' config option to in_tail plugin#12097
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe Tail input adds the ChangesTail unavailable-path handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
plugins/in_tail/tail.cplugins/in_tail/tail_config.hplugins/in_tail/tail_scan.cplugins/in_tail/tail_scan_glob.c
74844a2 to
892e771
Compare
There was a problem hiding this comment.
💡 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".
| 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) { |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
plugins/in_tail/tail.cplugins/in_tail/tail_config.hplugins/in_tail/tail_scan.cplugins/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
…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>
c75f633 to
064239f
Compare
Signed-off-by: ner216 <provencher.nolan@gmail.com>
064239f to
bebe503
Compare
|
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. |
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:
Output with Ignore_Unavailable set to false:
Output with Ignore_Unavailable set to true:
Valgrind output:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
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
ignore_unavailableoption to the Tail input (boolean, default:false) to skip non-existent/unavailable directories when matching files.ignore_unavailableis disabled.