Guide
Log metrics
A log metric counts the log lines that match a search, or measures a number on them, as they arrive, and stores the result as a metric named logs.<name>. Use one when a chart or alert asks the same question of your logs again and again: "errors per route", "checkout latency per service", "failed sign-ins".
- Kept longer. A log metric is stored as a metric, so it is kept for your metric retention, even after the lines it came from are gone.
- Cheaper and faster. Dashboards and alerts read one point per series per minute instead of scanning every matching line again.
- Exact. A count equals the number of matching lines, minute by minute. For a number field, count, sum, average, minimum and maximum are exact; percentiles are read within the buckets.
Make one#
You need the owner or admin role. Start from any of:
- Explore: search for the lines, then ⋮ → Make a log metric.
- A field in an event's details or a pipeline preview: Make a log metric → Measure duration_ms or Count lines by route.
- Metrics → Log metrics → New log metric.
The setup has four steps on one page:
- What to count. The search that picks the lines, written as in Explore (
service:checkout severity:error,status>=500 or payment), or*for every line. Choose Count the lines, or Measure a number on them and pick the field: the fields that hold numbers on those lines in the last hour are offered. - By what. Up to 3 labels:
service,severity,env, or any field on the lines, offered with how many values each has. Each distinct combination is one series. - Preview. The rule runs on your own lines from the last hour: how many match, a per-minute chart, the number of series and the largest ones, and for a number field its minimum, p50, p95, maximum and the buckets it will use.
- Name and activate. The metric is
logs.<name>. Activate starts counting from the next minute; Save paused keeps it for later (Home lists paused log metrics until you resume them).
Points appear about two minutes after the lines. Nothing is counted for the time before a log metric was activated: use Explore or | stats for earlier periods.
Use it#
A log metric is an ordinary metric:
- Metrics: open it (the list shows Log metric with its search), group and filter by its labels. A count is a counter: choose Increase for lines per step, or Rate for lines per second. A distribution is a histogram: choose Count, Sum, Average, Minimum, Maximum or a percentile.
- Dashboards: ⋮ → Add to dashboard from Metrics.
- Alerts: ⋮ → Create alert from Metrics. An alert reads the same points as the chart, so its value is the chart's value.
- AI agents and Pari:
list_log_metrics,preview_log_metric,create_log_metric, andquery_metricto read them.
What a search can use#
The search is the part before the first |, with the meaning Explore gives it: services, severities, words, field comparisons, exists(...), and or, AND, NOT and parentheses. A log metric works on each line as it arrives, so:
- Pipe stages (
| json,| parse,| where,| stats) are not available. A field Explore reads only through| jsonor| parseis not on the line yet: turn on automatic JSON parsing or parse it at ingest with a pipeline first (Pipelines). The preview says when no line has a number in the field you chose. - Regular expressions (
=~) andtsare not available. envworks as in Explore: fromdeployment.environmentand similar fields, or from the service name (prd-checkout), in any case. Made from Explore with an environment chosen in the top bar, the log metric counts that environment only.envcan also be a label.- Lines a pipeline drops are not counted; fields a pipeline adds are.
Limits#
| Log metrics per workspace | 100, of which 25 active at once |
| Labels per log metric | 3 |
| Label values | the first 128 characters |
| Series | 1,000 per log metric and 5,000 per workspace, per minute |
| Buckets of a distribution | up to 30 |
Beyond the series limits, the smallest series of that minute are counted together in one series whose labels are all _other, so totals stay exact. The preview warns when a label has that many values.
Change, pause and delete#
What a log metric counts, and its name, cannot change once it is created, because a series whose meaning or name changes halfway charts wrong. To change it, ⋮ → Duplicate (a paused copy) and pause or delete the old one. Pause stops counting until you resume it. Delete stops counting; points already written stay for your retention, and the name is not used again.
Minutes that can be missing#
Counts wait in Logthread's cache for a minute or two before they are written. If that cache restarts in that window, those minutes are missing from the metric; your log lines are not affected.
Usage and cost#
Log metrics are an add-on: ₹2,500 ($29) per workspace, billed for a month in which a log metric was active, and only then. Pause or delete every log metric and the next month has no charge for it. The price is also shown in the setup and on the Usage page (Prices).
Log metric points are not billed as ingested data. They appear on the Usage page with the other data Logthread writes for you.