---
title: "Get a log-based metric"
method: GET
path: "/api/v2/logs/config/metrics/{metric_id}"
tags: ["Logs Metrics"]
---

# Get a log-based metric

`GET /api/v2/logs/config/metrics/{metric_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/logs/config/metrics/{metric_id}`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Get a specific log-based metric from your organization.

## Path parameters

- `metric_id` string, required

## Response `200`

OK

- LogsMetricResponse: The log-based metric object.
  - `data` LogsMetricResponseData: The log-based metric properties.
    - `attributes` LogsMetricResponseAttributes: The object describing a Datadog log-based metric.
      - `compute` LogsMetricResponseCompute: The compute rule to compute the log-based metric.
        - `aggregation_type` 'count' | 'distribution': The type of aggregation to use.
        - `include_percentiles` boolean: Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the `aggregation_type` is `distribution`.
        - `path` string: The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution").
      - `filter` LogsMetricResponseFilter: The log-based metric filter. Logs matching this filter will be aggregated in this metric.
        - `query` string: The search query - following the log search syntax.
      - `group_by` LogsMetricResponseGroupBy[]: The rules for the group by.
        - `path` string: The path to the value the log-based metric will be aggregated over.
        - `tag_name` string: Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
    - `id` string: The name of the log-based metric.
    - `type` 'logs_metrics': The type of the resource. The value should always be logs_metrics.

## Other responses

- `403`: Not Authorized
- `404`: Not Found
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
