> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/integrations/processors/parse-key-value.md).

# Parse Key Value

Parses a string of key-value pairs (for example `action=login status=success`) from a source field into a structured map, then writes the result to a target field. You control the delimiter that splits each key from its value and the delimiter that separates one pair from the next.

### Supported Telemetry Types

| Logs | Metrics | Traces |
| ---- | ------- | ------ |
| ✓    | ✓       | ✓      |

Choose Telemetry Type picks one signal per processor instance. Add another instance to handle a second signal.

### Configuration

#### Basic Configuration

<figure><img src="/files/HwpKreJ1tsflFXfjyH1v" alt="Bindplane docs - Parse Key Value - image 1"><figcaption></figcaption></figure>

**Selection**

| Parameter             | Type               | Required | Default   | Description                                                                 |
| --------------------- | ------------------ | -------- | --------- | --------------------------------------------------------------------------- |
| Choose Telemetry Type | Telemetry Selector | Yes      | Logs      | The signal this instance runs on: Logs, Metrics, or Traces (one at a time). |
| Condition             | OTTL Condition     | No       | *(empty)* | Parse only the records that match. Empty runs on every record.              |

**Source and target fields**

| Parameter         | Type                                     | Required | Default    | Description                                                                                                                                                                     |
| ----------------- | ---------------------------------------- | -------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Source Field Type | Enum: Resource, Attributes, Body, Custom | Yes      | Attributes | Where the key-value string is read from. **Body is logs-only.** Custom takes any OTTL path.                                                                                     |
| Source Field      | OTTL Field                               | Yes \*   | *(empty)*  | The field holding the key-value string. For a Body source, leave empty to parse the entire body.                                                                                |
| Target Field Type | Enum: Resource, Attributes, Body, Custom | Yes      | Attributes | Where the parsed map is written. **Body is logs-only.** Custom takes any OTTL path.                                                                                             |
| Target Field      | OTTL Field                               | Yes \*   | *(empty)*  | Destination for the parsed map. Leave empty to merge the parsed pairs into the chosen target context (resource, attributes, or body) instead of nesting them under a new field. |

\* The **Body** field type is the exception: it's optional, and leaving it empty targets the entire body. For Metrics and Traces the field type options are Resource, Attributes, and Custom (no Body).

**Delimiters**

| Parameter      | Type   | Required | Default   | Description                                                                      |
| -------------- | ------ | -------- | --------- | -------------------------------------------------------------------------------- |
| Pair Delimiter | String | No       | *(empty)* | The string separating one pair from the next. Leave empty to use a single space. |
| Delimiter      | String | No       | *(empty)* | The string separating each key from its value. Leave empty to use `=`.           |

### Examples

#### Parse a key-value attribute into structured fields

A log carries event details as a single attribute string:

```json
{
  "level": "info",
  "eventDetails": "action:login!status:success"
}
```

To split that into addressable fields, set:

* Choose Telemetry Type: `Logs`
* Condition: `attributes["eventDetails"] != nil`
* Source Field Type: `Attributes`
* Source Field: `eventDetails`
* Target Field Type: `Attributes`
* Target Field: `parsedEventDetails`
* Pair Delimiter: `!`
* Delimiter: `:`

The result keeps the original string and adds the parsed map:

```json
{
  "level": "info",
  "eventDetails": "action:login!status:success",
  "parsedEventDetails": {
    "action": "login",
    "status": "success"
  }
}
```

### Configuration Tips

* The default Delimiter is `=` and the default Pair Delimiter is a single space, so a string like `host=web01 region=us-east` parses with no delimiter changes. Override both only when your data uses other separators.
* Leave Target Field empty to merge the parsed keys directly into the chosen context (attributes, resource, or body). Set a Target Field name to nest the parsed map under that single field instead.

### Troubleshooting

#### The target field is empty or unchanged

Symptoms: no parsed map appears after the processor runs.

Solutions:

1. Confirm the source field actually holds a key-value string and the Condition evaluates true.
2. Check that the Delimiter and Pair Delimiter match the separators in your data. The wrong delimiter yields no usable pairs.

#### Parsed values land in the wrong place

Symptoms: keys merge into a context you didn't expect, or overwrite existing fields.

Solutions:

1. Leaving Target Field empty merges keys into the whole target context. Set an explicit Target Field name to keep them isolated under one field.
2. Parsing from Body or Attributes into the Resource field is not supported.

### Standalone Processor

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  name: parse-key-value
spec:
  type: parse_key_value
  parameters:
    - name: telemetry
      value: Logs
    - name: condition
      value: attributes["eventDetails"] != nil
    - name: logs_source_field_type
      value: Attributes
    - name: logs_attribute_source_field
      value: eventDetails
    - name: logs_target_field_type
      value: Attributes
    - name: logs_attribute_target_field
      value: parsedEventDetails
    - name: pair_delimiter
      value: "!"
    - name: delimiter
      value: ":"
```

### Related Resources

* [ParseKeyValue — OTTL function reference](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/ottlfuncs/README.md#parsekeyvalue)

### Bindplane Resources

These parsers turn raw field text into structured data. Chain them to normalize and parse telemetry end to end:

* [Parse JSON](/integrations/processors/parse-json.md)
* [Parse CSV](/integrations/processors/parse-csv.md)
* [Parse with Regex](/integrations/processors/parse-with-regex.md)
* [Parse Severity](/integrations/processors/parse-severity.md)
* [Parse Timestamp](https://github.com/observIQ/bindplane-docs/blob/main/docs/integrations/processors/parse-timestamp.md)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bindplane.com/integrations/processors/parse-key-value.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
