Skip to content

feat: add config example validation script and workflow#2627

Draft
patrick-stephens wants to merge 25 commits into
masterfrom
2459_auto_validate_config_examples
Draft

feat: add config example validation script and workflow#2627
patrick-stephens wants to merge 25 commits into
masterfrom
2459_auto_validate_config_examples

Conversation

@patrick-stephens

@patrick-stephens patrick-stephens commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Resolves #2459 by providing a simple AWK based approach to validating configuration examples:

  • We extract config using AWK searching for the Gitbook specific tags
  • We use the container image to then --dry-run the configuration and report success/failure
  • We repeat this for every example in the same file as there may be multiple ones.

A local script is provided that can be run for any file in the repo or all of them:

find . -type f -iname "*.md" | while read -r file; do ./scripts/test-config.sh $file; done

A workflow is provided to run this for any files changed in a PR so if an update is made to documentation it should check it is valid.

There is a basic suppression approach by file as there are some valid reasons for this:

  • Windows-specific plugins will fail in the container image
  • Some plugins, e.g. exec are not part of the container image
  • Some examples show loading custom WASM, LUA, Golang, etc. which is not available or easy to do in CI

As part of these changes we also found failures in existing files that were resolved.
Some tweaks were also required, e.g. parser definition must be in a separate file for legacy TOML config so it was updated to be a comment for the examples (which would be rejected anyway otherwise).

There are options to use something more complex like markdown-tree or similar to build an AST from the Markdown file to then pull out the bits we need but this may not work with the specific Gitbook format anyway and requires a whole load of extra dependencies.

Currently there is an upstream failure with certain plugins triggering a segmentation fault for --dry-run: fluent/fluent-bit#12113

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9daba772-fcd9-4d5d-81a8-95574c907bdb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2459_auto_validate_config_examples

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.

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Comment thread scripts/README.md
Validates all Fluent Bit configuration examples in Markdown files by running them through `fluent-bit --dry-run`.

**Usage:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
This approach ensures that extraction errors are always legitimate—never due to reaching the end of examples. Any extraction error indicates a genuine problem with the file structure.

**Features:**
- Supports multiple examples per Markdown file (processes all examples)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Supports multiple examples p..."]

Comment thread scripts/README.md
- Only reports errors that are legitimate (malformed examples or configuration issues)

**Example - validate a single file:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
```

**Example - validate all documentation files:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
Extracts Fluent Bit configuration code blocks from Markdown files. This is used internally by `test-config.sh` but can also be called directly.

**Usage:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
```

**Parameters:**
- `markdown-file`: Path to the Markdown file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- markdown-file: Path to the..."]

Comment thread scripts/README.md
Validates all Fluent Bit configuration examples in Markdown files by running them through `fluent-bit --dry-run`.

**Usage:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
This approach ensures that extraction errors are always legitimate—never due to reaching the end of examples. Any extraction error indicates a genuine problem with the file structure.

**Features:**
- Supports multiple examples per Markdown file (processes all examples)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
- Supports multiple examples per Markdown file (processes all examples)
- Supports multiple examples per Markdown file (processes all examples)

Comment thread scripts/README.md
- Only reports errors that are legitimate (malformed examples or configuration issues)

**Example - validate a single file:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
```

**Example - validate all documentation files:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
Extracts Fluent Bit configuration code blocks from Markdown files. This is used internally by `test-config.sh` but can also be called directly.

**Usage:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
```

**Parameters:**
- `markdown-file`: Path to the Markdown file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
- `markdown-file`: Path to the Markdown file
- `markdown-file`: Path to the Markdown file

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
…in TOML format

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Comment thread scripts/README.md
- `index|count` (Optional): Extract a specific example by index, or use `count` to get the total number of examples. Defaults to 1 (first example)

**Features:**
- Automatically removes common leading indentation from extracted examples

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Automatically removes common..."]

Comment thread scripts/README.md
- Preserves relative indentation within the configuration

**Examples:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
**Count mode:**

The `count` parameter returns the total number of matching code fences for the specified language in the given tab. This is used by `test-config.sh` to:
1. Determine how many examples to validate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. Determine how many examples..."]

Comment thread scripts/README.md
3. Ensure all extraction errors are legitimate

Example output:
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]

Comment thread scripts/README.md
```yaml
service:
flush: 1
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

Comment thread scripts/README.md
{% tab title="fluent-bit.yaml" %}
```yaml
# First example YAML
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

Comment thread scripts/README.md

{% tabs %}
{% tab title="fluent-bit.yaml" %}
```yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```yaml"]

Comment thread scripts/README.md
{% tab title="fluent-bit.yaml" %}
```yaml
# Second example YAML
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

Comment thread scripts/README.md
```
{% endtab %}
{% endtabs %}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

Comment thread scripts/README.md
```
{% endtab %}
{% endtabs %}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]

Comment thread scripts/README.md
- `index|count` (Optional): Extract a specific example by index, or use `count` to get the total number of examples. Defaults to 1 (first example)

**Features:**
- Automatically removes common leading indentation from extracted examples

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
- Automatically removes common leading indentation from extracted examples
- Automatically removes common leading indentation from extracted examples

Comment thread scripts/README.md
- Preserves relative indentation within the configuration

**Examples:**
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
**Count mode:**

The `count` parameter returns the total number of matching code fences for the specified language in the given tab. This is used by `test-config.sh` to:
1. Determine how many examples to validate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
1. Determine how many examples to validate
1. Determine how many examples to validate

Comment thread scripts/README.md
3. Ensure all extraction errors are legitimate

Example output:
```bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```bash
```bash

Comment thread scripts/README.md
service:
flush: 1
```
{% endtab %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
{% endtab %}
{% endtab %}

Comment thread scripts/README.md
```
{% endtab %}
{% endtabs %}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```
```

Comment thread scripts/README.md
```yaml
# First example YAML
```
{% endtab %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
{% endtab %}
{% endtab %}

Comment thread scripts/README.md

{% tabs %}
{% tab title="fluent-bit.yaml" %}
```yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```yaml
```yaml

Comment thread scripts/README.md
```yaml
# Second example YAML
```
{% endtab %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
{% endtab %}
{% endtab %}

Comment thread scripts/README.md
```
{% endtab %}
{% endtabs %}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[markdownlint-fix] reported by reviewdog 🐶

Suggested change
```
```

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@patrick-stephens
patrick-stephens force-pushed the 2459_auto_validate_config_examples branch from ba1f42c to 56630f1 Compare July 19, 2026 15:58
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-validate config examples

1 participant