> For the complete documentation index, see [llms.txt](https://docs.fluentbit.io/manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluentbit.io/manual/3.2/pipeline/processors/labels.md).

# Labels

![](https://static.scarf.sh/a.png?x-pxid=1e9a2474-00c3-4d8d-b170-79996be7af79)

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.
{% endhint %}

## 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.                                  |

#### Update example

Change the value of the `name` to `fluentbit`:

```yaml
pipeline:
  inputs:
    - name: fluentbit_metrics
      processors:
        metrics:
          - name: labels
            update: name fluentbit
  outputs:
    - name : stdout
      match: '*'
```

#### Insert example

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

```yaml
pipeline:
  inputs:
    - name: fluentbit_metrics
      processors:
        metrics:
          - name: labels
            insert: agent fluentbit
  outputs:
    - name : stdout
      match: '*'
```

#### Upsert example

Upsert the value of `name` and insert `fluentbit`:

```yaml
pipeline:
  inputs:
    - name: fluentbit_metrics
      processors:
        metrics:
          - name: labels
            upsert: name fluentbit
  outputs:
    - name : stdout
      match: '*'
```

#### Delete example

Delete containing `name` key from metrics:

```yaml
pipeline:
  inputs:
    - name: fluentbit_metrics
      processors:
        metrics:
          - name: labels
            delete: name
  outputs:
    - name : stdout
      match: '*'
```

#### Hash example

Apply the SHA-1 algorithm for the value of the key `hostname`:

```yaml
pipeline:
  inputs:
    - name: fluentbit_metrics
      processors:
        metrics:
          - name: labels
            hash: hostname
  outputs:
    - name : stdout
      match: '*'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fluentbit.io/manual/3.2/pipeline/processors/labels.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
