Skip to content
Merged
Show file tree
Hide file tree
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
63 changes: 29 additions & 34 deletions pipeline/processors/labels.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
# Labels
The **labels** processor lets you manipulate the labels of metrics.

Similar to filters, this processor presents a enriching/modifying mechanism to
perform operations for labels manipulation. The most significant difference is
that processors perform better than filters, and when chaining them there are no
encoding or decoding performance penalties.
The _labels_ processor lets you manipulate the labels of metrics.

Similar to filters, this processor presents a enriching/modifying mechanism to perform operations for labels manipulation. The most significant difference is that processors perform better than filters, and when chaining them there are no encoding or decoding performance penalties.

{% hint style="info" %}

**Note:** Both processors and this specific component can be enabled only by using
the YAML configuration format. Classic mode configuration format doesn't support
processors.
Only [YAML configuration files](../administration/configuring-fluent-bit/yaml/README.md) support processors.

{% endhint %}

## Configuration Parameters
## Configuration parameters

| Key | Description |
| :----- | :---------- |
| update | Update an existing key with a value into metrics. The key/value pair is required. If the specified key doesn't exist, the operation silently fails and has no effect. |
| insert | Insert a new key with a value into metrics. The key/value pair is required. |
| upsert | Upsert a specific key with a value, the `upsert` operation will try to update the value of the key. If the key does not exist, the key will be created. The key-value pair is required. |
| delete | Delete a key from the labels of metrics. The key/value pair is required. If the specified key doesn't exist, the operation silently fails and has no effect. |
| hash | Replace the key value with a hash generated by the SHA-256 algorithm from the specified label name. The generated binary value is set as a hex string. |
| Key | Description |
| --- | ----------- |
| `update` | Updates an existing key with a value into metrics. The key/value pair is required. If the specified key doesn't exist, the operation silently fails and has no effect. |
| `insert` | Inserts a new key with a value into metrics. The key/value pair is required. |
| `upsert` | Upserts a specific key with a value, the `upsert` operation will try to update the value of the key. If the specified key doesn't exist, a new key will be created. The key/value pair is required. |
| `delete` | Deletes a key from the labels of metrics. The key/value pair is required. If the specified key doesn't exist, the operation silently fails and has no effect. |
| `hash` | Replaces the key value with a hash generated by the SHA-256 algorithm from the specified label name. The generated binary value is set as a hex string. |

#### Update example
### Update example

Change the value of the `name` to `fluentbit`:
The following example changes the value of the `name` key to `fluentbit`:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -35,7 +31,7 @@ Change the value of the `name` to `fluentbit`:
pipeline:
inputs:
- name: fluentbit_metrics

processors:
metrics:
- name: labels
Expand All @@ -48,10 +44,9 @@ pipeline:
{% endtab %}
{% endtabs %}

#### Insert example
### Insert example

The following example appends the key `agent` with the value `fluentbit` as the label
of metrics:
The following example appends the key `agent` with the value `fluentbit` as the label of metrics:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -60,12 +55,12 @@ of metrics:
pipeline:
inputs:
- name: fluentbit_metrics

processors:
metrics:
- name: labels
insert: agent fluentbit

outputs:
- name : stdout
match: '*'
Expand All @@ -74,9 +69,9 @@ pipeline:
{% endtab %}
{% endtabs %}

#### Upsert example
### Upsert example

Upsert the value of `name` and insert `fluentbit`:
The following example upserts the value of `name` and inserts `fluentbit`:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -85,7 +80,7 @@ Upsert the value of `name` and insert `fluentbit`:
pipeline:
inputs:
- name: fluentbit_metrics

processors:
metrics:
- name: labels
Expand All @@ -98,9 +93,9 @@ pipeline:
{% endtab %}
{% endtabs %}

#### Delete example
### Delete example

Delete containing `name` key from metrics:
The following example deletes the `name` key from metrics:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -109,7 +104,7 @@ Delete containing `name` key from metrics:
pipeline:
inputs:
- name: fluentbit_metrics

processors:
metrics:
- name: labels
Expand All @@ -122,9 +117,9 @@ pipeline:
{% endtab %}
{% endtabs %}

#### Hash example
### Hash example

Apply the SHA-1 algorithm for the value of the key `hostname`:
The following example applies the SHA-1 algorithm for the value of the key `hostname`:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -133,7 +128,7 @@ Apply the SHA-1 algorithm for the value of the key `hostname`:
pipeline:
inputs:
- name: fluentbit_metrics

processors:
metrics:
- name: labels
Expand All @@ -144,4 +139,4 @@ pipeline:
```

{% endtab %}
{% endtabs %}
{% endtabs %}
1 change: 1 addition & 0 deletions vale-styles/FluentBit/Spelling-exceptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ Unary
unmuted
unsort
upsert
upserts
UUIDs
Vectra
Vercel
Expand Down