List extracted metrics
List a source's extracted metrics, the rules that turn logs into metrics.
Source whose extracted metrics are listed.
Page to return, starting at 1.
Results per page. Maximum 250.
Team to use, such as t123. Get the ID via List teams. Required when you can access more than one team.
Bearer $TOKEN
Results are paginated
Use pagination.next and pagination.prev to move through pages or jump to a specific one using page and per_page. See Pagination.
{
"data": [
{
"id": "m-123",
"type": "metric",
"attributes": {
"id": "m-123",
"name": "level",
"sql_expression": "JSONExtract(raw, 'level', 'Nullable(String)')",
"type": "string_low_cardinality",
"aggregations": [
"avg",
"histogram",
"min",
"max"
],
"team_id": "t123"
}
}
],
"pagination": {
"first": "https://telemetry.betterstack.com/api/v4/sources/123/extracted-metrics?page=1",
"last": "https://telemetry.betterstack.com/api/v4/sources/123/extracted-metrics?page=1",
"prev": null,
"next": null,
"total_count": 1
}
}
{
"errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
{
"errors": "Resource with the provided ID was not found"
}
Returns the list of extracted metrics.
The API token is missing or invalid.
Your role doesn't allow viewing this, or the token can't be used for this API.
The source doesn't exist, or the token can't access it.
The ID of the extracted metric, such as m-123.
Always metric.
The ID of the extracted metric, starting with m- for a metric and g- for a label, such as m-123.
Metric or label name.
SQL expression evaluated for each log. Log fields are in the raw JSON field, so read them with JSONExtract(raw, ..., 'Nullable(Type)').
ClickHouse type the value is stored as. Possible values: string, string_low_cardinality, int64_delta, int64, uint64_delta, uint64, float64_delta, datetime64_delta, boolean.
Aggregations to precompute, avg, count, uniq, max, min, sum or histogram. An empty array makes this a label rather than a metric.
Team that owns the metric's source, such as t123.
The URL of the first page of results.
The URL of the last page of results.
The URL of the previous page, or null on the first page.
The URL of the next page, or null on the last page.
How many results the whole list holds, across every page.
Example cURL