Skip to content

Commit fb7975b

Browse files
authored
Added missing YAML examples for Router docs. Fixes #1733. (#1734)
Signed-off-by: Eric D. Schabell <[email protected]>
1 parent ccd1bd7 commit fb7975b

File tree

1 file changed

+76
-1
lines changed

1 file changed

+76
-1
lines changed

concepts/data-pipeline/router.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,30 @@ To define where to route data, specify a `Match` rule in the output configuratio
3636
Consider the following configuration example that delivers `CPU` metrics to an
3737
Elasticsearch database and Memory (`mem`) metrics to the standard output interface:
3838

39+
{% tabs %}
40+
{% tab title="fluent-bit.yaml" %}
41+
42+
```yaml
43+
pipeline:
44+
inputs:
45+
- name: cpu
46+
tag: my_cpu
47+
48+
- name: mem
49+
tag: my_mem
50+
51+
outputs:
52+
- name: es
53+
match: my_cpu
54+
55+
- name: stdout
56+
match: my_mem
57+
```
58+
59+
{% endtab %}
60+
61+
{% tab title="fluent-bit.conf" %}
62+
3963
```text
4064
[INPUT]
4165
Name cpu
@@ -54,6 +78,9 @@ Elasticsearch database and Memory (`mem`) metrics to the standard output interfa
5478
Match my_mem
5579
```
5680

81+
{% endtab %}
82+
{% endtabs %}
83+
5784
Routing reads the `Input` `Tag` and the `Output` `Match` rules. If data has a `Tag`
5885
that doesn't match at routing time, the data is deleted.
5986

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

92+
{% tabs %}
93+
{% tab title="fluent-bit.yaml" %}
94+
95+
```yaml
96+
pipeline:
97+
inputs:
98+
- name: cpu
99+
tag: my_cpu
100+
101+
- name: mem
102+
tag: my_mem
103+
104+
outputs:
105+
- name: stdout
106+
match: 'my_*'
107+
```
108+
109+
{% endtab %}
110+
111+
{% tab title="fluent-bit.conf" %}
112+
65113
```text
66114
[INPUT]
67115
Name cpu
@@ -76,6 +124,9 @@ example defines a common destination for both sources of data:
76124
Match my_*
77125
```
78126

127+
{% endtab %}
128+
{% endtabs %}
129+
79130
The match rule is set to `my_*`, which matches any Tag starting with `my_`.
80131

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

138+
{% tabs %}
139+
{% tab title="fluent-bit.yaml" %}
140+
141+
```yaml
142+
pipeline:
143+
inputs:
144+
- name: temperature_sensor
145+
tag: temp_sensor_A
146+
147+
- name: humidity_sensor
148+
tag: humid_sensor_B
149+
150+
outputs:
151+
- name: stdout
152+
match: '.*_sensor_[AB]'
153+
```
154+
155+
{% endtab %}
156+
157+
{% tab title="fluent-bit.conf" %}
158+
87159
```text
88160
[INPUT]
89161
Name temperature_sensor
@@ -98,7 +170,10 @@ demonstrates how to route data from sources based on a regular expression:
98170
Match_regex .*_sensor_[AB]
99171
```
100172

173+
{% endtab %}
174+
{% endtabs %}
175+
101176
In this configuration, the `Match_regex` rule is set to `.*_sensor_[AB]`. This
102177
regular expression matches any `Tag` that ends with `_sensor_A` or `_sensor_B`,
103178
regardless of what precedes it. This approach provides a more flexible and powerful
104-
way to handle different source tags with a single routing rule.
179+
way to handle different source tags with a single routing rule.

0 commit comments

Comments
 (0)