---
title: "Log Metrics"
description: "Turn your structured logs into numbers per day and month: count lines, sum a numeric field, or count distinct values, split by any field, with a top list and a monthly reference. No extra SDK and no extra charge."
product: trace
language: en
url: https://abrova.ir/en/docs/trace/log-metrics
updated: 2026-11-09
---

# Log Metrics

Turn your structured logs into numbers per day and month: count lines, sum a numeric field, or count distinct values, split by any field, with a top list and a monthly reference. No extra SDK and no extra charge.

- **What are log metrics?** — Numbers read out of the logs your servers and apps already send: how many times a message was logged, the sum of a numeric field, or how many different values a field had, per day and per month.
- **Where?** — Abrova Console → your project → Trace → Insights → Log metrics. Up to 20 metrics per project, at no extra charge.

## 1. Log a fixed message with fields

A metric picks lines by their **message**, so log the same text every time and put what changes in the fields (the metadata):

```ts
// Node.js SDK
AbrovaTrace.info('call: ended', { durationMs: 650022, relayMs: 412000, accountId: user.accountId });
```

Numbers stay numbers (`412000`, not `"412 s"`). Fields can be nested (`device.model`).

## 2. Create a metric

Open **Trace → Insights**, then **New metric** in **Log metrics**:

| Setting | What it does |
| --- | --- |
| `Messages` | One to 10 exact messages, e.g. `call: ended`. Lines with another message are left out. |
| `Operation` | **Count** lines, **Sum** a numeric field, or **Count distinct** values of a field. |
| `Field` | For sum and count distinct: the field name, e.g. `relayMs` or `device.model`. |
| `Conditions` | Up to 5: a field equals, differs from, is greater or less than a value, exists or is missing. Example: `relayMs` greater than 0. |
| `Split by` | Up to 2 fields. Each value gets its own number and the top 10 are listed, e.g. split by `accountId` to see who used the most. |
| `Unit` | For sums: milliseconds, seconds or bytes, shown as minutes, hours, MB or GB. |
| `Monthly reference` | Optional. Each top row shows its share of it per month, e.g. 10 hours per account: who is close to it stands out at 90%. |

Some examples:

| Question | Metric |
| --- | --- |
| `Relay time per month` | Sum of `relayMs` over `call: ended`, unit milliseconds |
| `Accounts that used the relay` | Count distinct `accountId` over `call: ended`, condition `relayMs` greater than 0 |
| `Calls started, by outcome` | Count `call: started`, split by `relayAvailable` and `relayBlockedBy` |
| `New paid plans` | Count `plans: confirmed` |

## 3. Read the numbers

Each metric shows **Day** (last 30 days) or **Month** (last 12 months), the total of the range, and the top 10 values when it is split. A line with a split field missing is shown as **(not set)**. Above 200 different values on one day, the smaller ones are added up under **Other**.

- Days are **UTC** days. Numbers update every few minutes.
- A new or changed metric counts the logs Trace still keeps (the last 30 days), so it starts with history.
- Monthly numbers stay after the log lines themselves are deleted by retention, for about 13 months.
- A line counts on the day of its own time. Lines that arrive more than two days late are not counted.
- **Count distinct** is exact across days: the same account on two days counts once in the month.

## Roles

Everyone with access to the project sees the metrics. Members create metrics and change or delete their own; admins and owners change any. See [Roles & Permissions](https://abrova.ir/docs/trace/error-dashboard#roles-permissions).

## Privacy

Metrics keep numbers per day, and for **Count distinct** only a short one-way hash of each value, never the value. Values of **split by** fields are shown as they are, so split by an id, not by an e-mail address or a phone number.

## Alerts on log lines

To be told when a message appears, save it as a search on **Trace → Logs** and create a **Log query** rule, or use an **Issue seen** rule for errors. See [Alert rules](https://abrova.ir/docs/trace/alert-rules).

#### A metric shows nothing?

- The message must match exactly, including case and spaces. Copy it from a line on Trace → Logs.
- For a sum, the field must be a number in the log (`412000`), not text with a unit.
- A new metric needs a few minutes to count the kept logs.
