# Extract Metric

### Description

The Extract Metric Processor creates new metrics based on log telemetry. For logs matching a filter, the processor will extract a numerical value from a field and then create a metric with that value. The name, unit, and type of the created metric can be configured. Additionally, fields from matching logs can be preserved as metric attributes.

### Supported Types

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

### Supported Collector Versions

`v1.14.0`+

### Configuration

The configuration of an Extract Metric processor consists of a number of sub-metrics that are defined using fields described below.

<table><thead><tr><th width="99.0078125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Metric Name</td><td>The name of the metric that will be created.</td></tr><tr><td>Match</td><td>The log context the source field is located in. Options are <code>Body</code>, <code>Attributes</code>, and <code>Resource</code>.</td></tr><tr><td>Metric Field</td><td>The name of the source field containing a numeric value that will become the new metric value.</td></tr><tr><td>Metric Type</td><td>The type of metric that will be created. Options are <code>gauge_double</code>, <code>gauge_int</code>, <code>counter_double</code>, and <code>counter_int</code>.</td></tr><tr><td>Metric Unit</td><td>The unit of the created metric. Some default choices provided with the ability to create a custom unit.</td></tr><tr><td>Attributes</td><td>Existing attributes on the source log that should be carried over. Can also specify new metric attributes. Each value is an OTTL <a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/LANGUAGE.md#paths">path</a> expression that extracts data from the log.</td></tr></tbody></table>

### Example Configuration

In this configuration we are creating a new latency metric based on a field in the log body.

Here is the new `latency` metric created as a `gauge_double` with seconds set as the unit.

Now we can see the new metric in the snapshot view.


---

# Agent Instructions: 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:

```
GET https://docs.bindplane.com/integrations/processors/extract-metric.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
