Skip to content

docs: env: bash-style default value operator :-#2568

Merged
eschabell merged 2 commits into
fluent:masterfrom
benjaminmueggenburg-serato:master
May 22, 2026
Merged

docs: env: bash-style default value operator :-#2568
eschabell merged 2 commits into
fluent:masterfrom
benjaminmueggenburg-serato:master

Conversation

@benjaminmueggenburg-serato
Copy link
Copy Markdown
Contributor

@benjaminmueggenburg-serato benjaminmueggenburg-serato commented May 8, 2026

Waiting on code merge: fluent/fluent-bit#11787

Updates documentation to mention the default value operator i.e ${ENV_VAR:-default}. Feature applies to both legacy config and YAML config files.

Has some examples, and details the expected behaviour.

Summary by CodeRabbit

  • Documentation
    • Clarified environment-variable substitution syntaxes, including the default-value form.
    • Added a “Fallback behavior” / “Default values” section explaining resolution when variables are unset or empty and that nesting is not supported.
    • Noted minimum Fluent Bit version for default-value support and updated example output formatting.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

📝 Walkthrough

Walkthrough

Clarifies Fluent Bit environment-variable substitution: lists supported syntaxes including ${MY_VARIABLE:-default_value}, adds a "Fallback behavior" section (notes nesting is unsupported), and adds a YAML "Default values" section with a version note and example using ${FLUSH_INTERVAL:-5}.

Changes

Environment Variable Substitution Documentation

Layer / File(s) Summary
Supported interpolation formats
administration/configuring-fluent-bit/classic-mode/variables.md
Replaces standalone example with an explicit list of supported syntaxes and corrects the example's closing code fence.
Fallback behavior rules
administration/configuring-fluent-bit/classic-mode/variables.md
Adds "Fallback behavior" subsection stating ${VARIABLE:-DEFAULT} resolves to DEFAULT when the variable is unset or defined as an empty string; notes nested ${} is not supported.
Default values / YAML example and version note
administration/configuring-fluent-bit/yaml/environment-variables-section.md
Adds "Default values" section with minimum Fluent Bit version callout (5.0.6), documents ${VARIABLE_NAME:-DEFAULT_VALUE} fallback syntax, and shows service.flush: ${FLUSH_INTERVAL:-5} example with log_level: info.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through lines to make things clear,

Defaults now wake when values disappear.
No nesting tricks, just simple rules to see,
Configs behave as they ought to be,
Happy parsers, happy me!

🚥 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 accurately describes the main change: documenting the bash-style default value operator :- for environment variables in Fluent Bit configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
administration/configuring-fluent-bit/classic-mode/variables.md (2)

22-26: 💤 Low value

Minor terminology clarification.

The phrase "primary variable" at line 23 could be simplified to just "the variable" for clarity. The word "primary" doesn't add meaningful distinction here since there's only one variable being evaluated.

📝 Proposed simplification
-If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the primary variable meets either of the following conditions:
+If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the variable meets either of the following conditions:
🤖 Prompt for 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.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` around lines
22 - 26, Replace the phrase "primary variable" with "the variable" in the
"Fallback Behavior" section describing the `${VARIABLE:-DEFAULT}` syntax so the
bullet points read that Fluent Bit will use the `DEFAULT` value if the variable
is not defined (unset) or is defined but set to an empty string; update the
sentence containing "primary variable" under the "Fallback Behavior" heading to
use "the variable" for clarity.

17-17: 💤 Low value

Grammar: Use hyphen to join compound modifier.

"Debian based system" should be "Debian-based system" when used as a compound adjective before a noun.

📝 Proposed fix
-- `/etc/default/fluent-bit` (Debian based system)
+- `/etc/default/fluent-bit` (Debian-based system)
🤖 Prompt for 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.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` at line 17,
The phrase "/etc/default/fluent-bit (Debian based system)" uses "Debian based"
as a compound modifier; update that text to read "/etc/default/fluent-bit
(Debian-based system)" so the compound adjective is hyphenated correctly.
🤖 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 `@administration/configuring-fluent-bit/yaml/environment-variables-section.md`:
- Around line 68-79: The "Default Values" section currently says defaults apply
only "if the variable is not defined"; update the text to state that the
`${VARIABLE_NAME:-DEFAULT_VALUE}` syntax supplies the DEFAULT_VALUE both when
the variable is unset and when it is defined but set to an empty string, so the
behavior matches the classic-mode doc; adjust the explanatory sentence and any
examples (the `service.flush: ${FLUSH_INTERVAL:-5}` example) to reflect this
dual-case behavior and ensure wording mirrors the classic-mode variables.md
description.

---

Nitpick comments:
In `@administration/configuring-fluent-bit/classic-mode/variables.md`:
- Around line 22-26: Replace the phrase "primary variable" with "the variable"
in the "Fallback Behavior" section describing the `${VARIABLE:-DEFAULT}` syntax
so the bullet points read that Fluent Bit will use the `DEFAULT` value if the
variable is not defined (unset) or is defined but set to an empty string; update
the sentence containing "primary variable" under the "Fallback Behavior" heading
to use "the variable" for clarity.
- Line 17: The phrase "/etc/default/fluent-bit (Debian based system)" uses
"Debian based" as a compound modifier; update that text to read
"/etc/default/fluent-bit (Debian-based system)" so the compound adjective is
hyphenated correctly.
🪄 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: 0131c310-bdb3-4583-bef3-ac293feb8a38

📥 Commits

Reviewing files that changed from the base of the PR and between 61734b0 and 032baeb.

📒 Files selected for processing (2)
  • administration/configuring-fluent-bit/classic-mode/variables.md
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md

Comment thread administration/configuring-fluent-bit/yaml/environment-variables-section.md Outdated
Copy link
Copy Markdown
Contributor

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

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

I don't believe this is correct, the variable defaulting syntax is inherent to the shell itself rather than the config file.

Comment thread administration/configuring-fluent-bit/classic-mode/variables.md Outdated
Copy link
Copy Markdown
Collaborator

@eschabell eschabell left a comment

Choose a reason for hiding this comment

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

@benjaminmueggenburg-serato my review requires some fixes first.

Comment thread administration/configuring-fluent-bit/classic-mode/variables.md Outdated
Comment thread administration/configuring-fluent-bit/classic-mode/variables.md Outdated
Comment thread administration/configuring-fluent-bit/classic-mode/variables.md Outdated
Comment thread administration/configuring-fluent-bit/yaml/environment-variables-section.md Outdated
Comment thread administration/configuring-fluent-bit/yaml/environment-variables-section.md Outdated
@eschabell eschabell added the waiting-on-review Waiting on a review from mainteners label May 8, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
administration/configuring-fluent-bit/classic-mode/variables.md (1)

23-23: 💤 Low value

Consider simplifying "primary variable" to "variable".

The term "primary variable" is slightly awkward since there's no secondary variable being discussed. Simply "variable" would be more direct.

📝 Suggested simplification
-If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the primary variable meets either of the following conditions:
+If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the variable meets either of the following conditions:
🤖 Prompt for 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.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` at line 23,
The sentence describing `${VARIABLE:-DEFAULT}` should use "variable" instead of
the awkward phrase "primary variable"; update the text "if the primary variable
meets either of the following conditions" to "if the variable meets either of
the following conditions" so the wording is simpler and clearer (refer to the
existing `${VARIABLE:-DEFAULT}` example in the same sentence).
🤖 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.

Nitpick comments:
In `@administration/configuring-fluent-bit/classic-mode/variables.md`:
- Line 23: The sentence describing `${VARIABLE:-DEFAULT}` should use "variable"
instead of the awkward phrase "primary variable"; update the text "if the
primary variable meets either of the following conditions" to "if the variable
meets either of the following conditions" so the wording is simpler and clearer
(refer to the existing `${VARIABLE:-DEFAULT}` example in the same sentence).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4b6cec43-41ac-45f9-a1c4-580ef970438b

📥 Commits

Reviewing files that changed from the base of the PR and between 032baeb and 4684811.

📒 Files selected for processing (2)
  • administration/configuring-fluent-bit/classic-mode/variables.md
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md
✅ Files skipped from review due to trivial changes (1)
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md

Copy link
Copy Markdown
Contributor

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

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

Implementation is merged now so just waiting on a release.

We may need to flag the minimum version this feature is supported in as well, i.e. it is >5.0.4.

Comment thread administration/configuring-fluent-bit/classic-mode/variables.md Outdated
Signed-off-by: benjaminmueggenburg-serato <benjamin.mueggenburg@serato.com>
@cosmo0920
Copy link
Copy Markdown
Contributor

FYI: This feature will be shipped as v5.0.6 not v5.0.5.

Copy link
Copy Markdown
Collaborator

@eschabell eschabell left a comment

Choose a reason for hiding this comment

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

Small change requested!

1. The variable **isn't defined** (unset).
2. The variable is defined but set to an **empty string** (`''`).

Nesting **isn't supported**. You cannot use the `${}` syntax within another `${}` definition. `${MY_VAR:-${OTHER_VAR}}` would be invalid.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@benjaminmueggenburg-serato small fix needed here for vale lint issue.

@eschabell eschabell added 5.0.6 and removed 5.0.5 labels May 18, 2026
Signed-off-by: Eric D. Schabell <eric@schabell.org>
@eschabell
Copy link
Copy Markdown
Collaborator

Fixed listing for you @benjaminmueggenburg-serato so we can get this in the docs for 5.0.6.

@eschabell eschabell removed the waiting-on-review Waiting on a review from mainteners label May 22, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
administration/configuring-fluent-bit/classic-mode/variables.md (2)

9-10: 💤 Low value

Consider consistent placeholder naming across examples.

Line 10 uses default_value while line 27 uses DEFAULT as the placeholder. For reader clarity, consider using the same placeholder style throughout the document.

📝 Suggested adjustment for consistency
-* **With Default Value:** `${MY_VARIABLE:-default_value}` (**v5.0.6+**) 
+* **With Default Value:** `${MY_VARIABLE:-default}` (**v5.0.6+**)
🤖 Prompt for 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.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` around lines
9 - 10, Replace the inconsistent placeholder between examples so all examples
use the same placeholder style; specifically, make
`${MY_VARIABLE:-default_value}` match the other example that currently uses
`${MY_VARIABLE:-DEFAULT}` by changing the latter to
`${MY_VARIABLE:-default_value}` (or vice versa) so `${MY_VARIABLE}` and the
defaulted form use a consistent placeholder naming throughout the document.

21-31: ⚡ Quick win

Expand contractions for technical documentation standards.

Vale linters commonly flag contractions in technical documentation. The following contractions should be expanded:

  • Line 28: "isn't defined" → "is not defined"
  • Line 31: "isn't supported" → "is not supported"
  • Line 31: "can't use" → "cannot use"
📝 Proposed fix
-1. The variable **isn't defined** (unset).
+1. The variable **is not defined** (unset).
 2. The variable is defined but set to an **empty string** (`''`).
 
-Nesting **isn't supported**. You can't use the `${}` syntax within another `${}` definition. `${MY_VAR:-${OTHER_VAR}}` would be invalid.
+Nesting **is not supported**. You cannot use the `${}` syntax within another `${}` definition. `${MY_VAR:-${OTHER_VAR}}` would be invalid.
🤖 Prompt for 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.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` around lines
21 - 31, Update the text surrounding the `${VARIABLE:-DEFAULT}` section to
expand contractions: replace "isn't defined" with "is not defined" in the
sentence describing when DEFAULT is used, and replace "isn't supported" with "is
not supported" and "can't use" with "cannot use" in the sentence about nesting;
keep the examples and the `${MY_VAR:-${OTHER_VAR}}` invalid-example intact and
preserve formatting and hint block.
🤖 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.

Nitpick comments:
In `@administration/configuring-fluent-bit/classic-mode/variables.md`:
- Around line 9-10: Replace the inconsistent placeholder between examples so all
examples use the same placeholder style; specifically, make
`${MY_VARIABLE:-default_value}` match the other example that currently uses
`${MY_VARIABLE:-DEFAULT}` by changing the latter to
`${MY_VARIABLE:-default_value}` (or vice versa) so `${MY_VARIABLE}` and the
defaulted form use a consistent placeholder naming throughout the document.
- Around line 21-31: Update the text surrounding the `${VARIABLE:-DEFAULT}`
section to expand contractions: replace "isn't defined" with "is not defined" in
the sentence describing when DEFAULT is used, and replace "isn't supported" with
"is not supported" and "can't use" with "cannot use" in the sentence about
nesting; keep the examples and the `${MY_VAR:-${OTHER_VAR}}` invalid-example
intact and preserve formatting and hint block.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2272ead2-b9c4-474a-b49d-c4ecb8704905

📥 Commits

Reviewing files that changed from the base of the PR and between 3284523 and 09356f0.

📒 Files selected for processing (2)
  • administration/configuring-fluent-bit/classic-mode/variables.md
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md
✅ Files skipped from review due to trivial changes (1)
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md

@eschabell eschabell merged commit 5d33bc2 into fluent:master May 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants