Extract Metric
Creates new metrics from log telemetry. For logs matching a condition, the processor extracts a numeric value from a field and emits a metric with that value. Configure the metric name, type, unit, and which log fields to carry over as metric attributes. All logs pass through unchanged; the extracted metrics are routed onward as a metrics stream.
Supported Telemetry
✓
The processor reads logs and produces metrics. Define one or more metrics; each is extracted independently.
Configuration

Add one or more metrics with the Add Metric button. Each metric is configured with the fields below.
Per-metric fields
Condition
OTTL Condition
No
(empty)
An OTTL condition that must evaluate to true for a log to be processed. By default the metric is extracted from all logs.
Metric Name
String
Yes
New Metric
Name of the metric that will be created.
Match
Enum: Body, Attributes, Resource
Yes
Body
The log context the source field is read from.
Metric Field
OTTL Field
Yes
(empty)
The field holding the numeric value that becomes the metric value. Resolved within the Match context.
Metric Type
Enum: gauge_double, gauge_int, counter_double, counter_int
Yes
gauge_double
The type of metric to create.
Metric Unit
Enum (custom allowed): s, ms, bytes, megabytes, gigabytes, b/s, MB/s, GB/s, %, requests/second, {logs}
Yes
{logs}
The unit of the created metric. Pick a preset or enter a custom unit.
Attributes
Map (Attribute → Expression)
No
(empty)
Existing log fields to carry over as metric attributes, or new attributes. Each value is an OTTL path expression that extracts data from the log.
Examples
Extract latency, request size, and an error counter
This processor defines three metrics from the same log stream, covering each metric type variant.
A
gauge_doublelatency metric in seconds, read from the log body, tagged with the request route.A
gauge_intrequest-size metric in bytes, read from a log attribute.A
counter_interror metric, gated by a condition so it only fires for 5xx responses.
Configuration Tips
The Metric Field is resolved within the Match context (Body, Attributes, or Resource). A field name set with Match = Body looks in the log body, not in attributes.
The source field must hold a numeric value. A
gauge_intorcounter_intmetric expects an integer; a string or floating-point value will not produce the integer metric you intend.Logs are never dropped by this processor. It only adds a metrics stream, so the original logs continue down the pipeline unchanged.
Troubleshooting
No metric is produced
Symptoms: the expected metric never appears downstream.
Solutions:
Confirm the Condition evaluates to true for the logs you expect. An empty condition matches all logs.
Verify the Metric Field exists in the selected Match context and holds a numeric value.
Metric appears but the value is wrong or zero
Symptoms: the metric is emitted but its value is empty, zero, or unexpected.
Solutions:
Check that the field value is numeric and matches the chosen Metric Type (use a
_doubletype for fractional values, a_inttype for whole numbers).For counters, confirm the field carries the increment you intend rather than a cumulative total.
Attributes are missing on the metric
Symptoms: the metric is created without the attributes you configured.
Solutions:
Each Attributes value is an OTTL path expression, for example
attributes["route"], not a bare field name.Confirm the referenced field is present on the matching logs.
Standalone Processor
Related Resources
Last updated
Was this helpful?