diff --git a/concepts/data-pipeline/router.md b/concepts/data-pipeline/router.md index 05e0924d8..ccc97e74f 100644 --- a/concepts/data-pipeline/router.md +++ b/concepts/data-pipeline/router.md @@ -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 @@ -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. @@ -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 @@ -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 @@ -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 @@ -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. \ No newline at end of file