Skip to content

Added missing YAML examples for Router docs. Fixes #1733. #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion concepts/data-pipeline/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ To define where to route data, specify a `Match` rule in the output configuratio
Consider the following configuration example that delivers `CPU` metrics to an
Elasticsearch database and Memory (`mem`) metrics to the standard output interface:

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

```yaml
pipeline:
inputs:
- name: cpu
tag: my_cpu

- name: mem
tag: my_mem

outputs:
- name: es
match: my_cpu

- name: stdout
match: my_mem
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```text
[INPUT]
Name cpu
Expand All @@ -54,6 +78,9 @@ Elasticsearch database and Memory (`mem`) metrics to the standard output interfa
Match my_mem
```

{% endtab %}
{% endtabs %}

Routing reads the `Input` `Tag` and the `Output` `Match` rules. If data has a `Tag`
that doesn't match at routing time, the data is deleted.

Expand All @@ -62,6 +89,27 @@ that doesn't match at routing time, the data is deleted.
Routing is flexible enough to support wildcards in the `Match` pattern. The following
example defines a common destination for both sources of data:

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

```yaml
pipeline:
inputs:
- name: cpu
tag: my_cpu

- name: mem
tag: my_mem

outputs:
- name: stdout
match: 'my_*'
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```text
[INPUT]
Name cpu
Expand All @@ -76,6 +124,9 @@ example defines a common destination for both sources of data:
Match my_*
```

{% endtab %}
{% endtabs %}

The match rule is set to `my_*`, which matches any Tag starting with `my_`.

## Routing with Regex
Expand All @@ -84,6 +135,27 @@ Routing also provides support for regular expressions with the `Match_Regex` pat
allowing for more complex and precise matching criteria. The following example
demonstrates how to route data from sources based on a regular expression:

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

```yaml
pipeline:
inputs:
- name: temperature_sensor
tag: temp_sensor_A

- name: humidity_sensor
tag: humid_sensor_B

outputs:
- name: stdout
match: '.*_sensor_[AB]'
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```text
[INPUT]
Name temperature_sensor
Expand All @@ -98,7 +170,10 @@ demonstrates how to route data from sources based on a regular expression:
Match_regex .*_sensor_[AB]
```

{% endtab %}
{% endtabs %}

In this configuration, the `Match_regex` rule is set to `.*_sensor_[AB]`. This
regular expression matches any `Tag` that ends with `_sensor_A` or `_sensor_B`,
regardless of what precedes it. This approach provides a more flexible and powerful
way to handle different source tags with a single routing rule.
way to handle different source tags with a single routing rule.