> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chronosphere.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Add/set key/value

export const entity_0 = "add/set key/value processing rule"

The add/set key/value [processing rule](/ingest/pipeline/processing-rules)
adds the same key/value pair to every record that passes through your pipeline. If a
record contains a matching key, this rule overwrites that key's associated value with
the value you specify.

## Configuration parameters

Use the parameters in this section to configure the {entity_0}. The
Telemetry Pipeline web interface uses the items in the **Name** column to
describe these parameters. [Pipeline configuration files](/ingest/pipeline/v2/configure/config-files)
use the items in the **Key** column as YAML keys.

| Name        | Key       | Description                                                                                                                                                                                     | Default |
| ----------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| **Key**     | `key`     | Required. The key to add to each record. You can use [record accessor syntax](/ingest/pipeline/processing-rules#record-accessor-syntax) to add or overwrite keys nested inside a parent object. | *none*  |
| **Value**   | `value`   | Required. The value to associate with your key. This value is identical for every instance of **Key**.                                                                                          | *none*  |
| **Comment** | `comment` | A custom note or description of the rule's function. This text is displayed next to the rule's name in the **Actions** list in the processing rules interface.                                  | *none*  |

## Example

Using the add/set key/value rule lets you add identifying information to events,
such as including the source from which they originate or their associated user
action.

For example, given this sample log data:

```json theme={null}
{"timestamp":"2023-03-28T09:08:41.64283645Z","user_id":3,"page_id":30,"action":"purchase", "source": "storefront"}
{"timestamp":"2023-03-28T09:08:42.643343109Z","user_id":4,"page_id":10,"action":"purchase", "source": "storefront"}
{"timestamp":"2023-03-28T09:08:48.643600498Z","user_id":1,"page_id":50,"action":"click"}
{"timestamp":"2023-03-28T09:08:50.643773688Z","user_id":5,"page_id":40,"action":"purchase", "source": "storefront"}
{"timestamp":"2023-03-28T09:08:51.643932272Z","user_id":1,"page_id":30,"action":"purchase", "source": "storefront"}
{"timestamp":"2023-03-28T09:08:56.644080944Z","user_id":2,"page_id":40,"action":"click"}
{"timestamp":"2023-03-28T09:09:03.64425954Z","user_id":3,"page_id":30,"action":"click"}
{"timestamp":"2023-03-28T09:09:03.644317046Z","user_id":1,"page_id":20,"action":"view"}
{"timestamp":"2023-03-28T09:09:10.64447719Z","user_id":2,"page_id":50,"action":"purchase", "source": "storefront"}
{"timestamp":"2023-03-28T09:09:17.644810963Z","user_id":2,"page_id":10,"action":"view"}
{"timestamp":"2023-03-28T09:09:20.644994805Z","user_id":1,"page_id":50,"action":"view"}
```

A rule with the **Key** value `source` and the **Value** value `acme-wholesale` returns the
following result:

```json theme={null}
{"source":"acme-wholesale","user_id":3,"page_id":30,"action":"purchase","timestamp":"2023-03-28T09:08:41.64283645Z"}
{"source":"acme-wholesale","user_id":4,"page_id":10,"action":"purchase","timestamp":"2023-03-28T09:08:42.643343109Z"}
{"source":"acme-wholesale","user_id":1,"page_id":50,"action":"click","timestamp":"2023-03-28T09:08:48.643600498Z"}
{"source":"acme-wholesale","user_id":5,"page_id":40,"action":"purchase","timestamp":"2023-03-28T09:08:50.643773688Z"}
{"source":"acme-wholesale","user_id":1,"page_id":30,"action":"purchase","timestamp":"2023-03-28T09:08:51.643932272Z"}
{"source":"acme-wholesale","user_id":2,"page_id":40,"action":"click","timestamp":"2023-03-28T09:08:56.644080944Z"}
{"source":"acme-wholesale","user_id":3,"page_id":30,"action":"click","timestamp":"2023-03-28T09:09:03.64425954Z"}
{"source":"acme-wholesale","user_id":1,"page_id":20,"action":"view","timestamp":"2023-03-28T09:09:03.644317046Z"}
{"source":"acme-wholesale","user_id":2,"page_id":50,"action":"purchase","timestamp":"2023-03-28T09:09:10.64447719Z"}
{"source":"acme-wholesale","user_id":2,"page_id":10,"action":"view","timestamp":"2023-03-28T09:09:17.644810963Z"}
{"source":"acme-wholesale","user_id":1,"page_id":50,"action":"view","timestamp":"2023-03-28T09:09:20.644994805Z"}
```

A `source` key is now included for each record, with the value `acme-wholesale`.
Records that already had a key named `source` had their values replaced with the new
value.
