Add Fields
The Add Fields processor sets attributes, resource fields, and log record body fields on telemetry in a pipeline. Each field can be inserted only when absent, updated only when present, or upserted (inserted or updated). An optional OTTL condition limits the processor to matching records. It operates on logs, metrics, and traces, though body fields apply to logs only.
Supported Telemetry Types
✓
✓
✓
Configuration

When to apply
Choose Telemetry Type
Telemetry Selector
Yes
Logs, Metrics, Traces
The signals this instance runs on. Fields are only applied to the selected telemetry types.
Condition
OTTL Condition
No
(empty)
An OTTL condition that must evaluate to true for a field to be applied. When empty, the processor applies to all telemetry.
Fields
The Fields parameter is a repeatable list. Each row adds or modifies one field.
Field Type
Enum: Attributes, Resource, Body
Yes
Attributes
The context the field is written to. Body is logs-only; Body rows are ignored for metrics and traces.
Action
Enum: Insert, Update, Upsert
Yes
Upsert
Insert adds the field only if it does not already exist. Update changes the value only if the field already exists. Upsert inserts or updates.
Key
String
Yes
—
The field name to add or modify. Use bracket notation for nested keys (for example attributes["k8s.pod.name"]).
Value
String
Yes
—
The value associated with the key.
Examples
Tag metrics with environment and region
Append static resource fields so metrics can be filtered by where they originated. This Fields list has three rows, covering Resource/Upsert, Resource/Insert, and Attributes/Update:
Add a resource field to error logs only
This example uses an OTTL condition so the field is added only to logs whose body level is error. Given a log body like:
Configure the condition and a single field:
Internally the processor renders an OTTL set statement against the transform processor, for example set(attributes["application_name"], "auth-service") where body["level"] == "error".
Configuration Tips
Action semantics matter:
Insertwill not overwrite an existing value,Updatewill not create a missing field, andUpsertalways writes. Pick the one that matches whether the field may already be present.Body fields are applied only to logs. If a Body row is configured while Metrics or Traces is selected, that row is silently skipped for those signals.
One instance can target multiple signals at once, but the Fields list is shared across them. Use separate instances when logs need body fields that metrics and traces should not receive.
Troubleshooting
A field is not being added
Symptoms: telemetry passes through unchanged after the processor runs.
Solutions:
Check the Action.
Insertis skipped when the key already exists, andUpdateis skipped when the key is absent. Switch toUpsertto write unconditionally.Confirm the Condition evaluates to true for the records you expect. An over-specific condition (or a quoting mistake, such as
== errorinstead of== "error") drops every record.
A body field never appears on metrics or traces
Symptoms: a Body-type row works for logs but has no effect on metrics or traces.
Solutions:
Body fields apply to logs only. Use Attributes or Resource for metrics and traces, or split the configuration into separate instances per signal.
Standalone Processor
Related Resources
Last updated
Was this helpful?