Log-based metrics

If you have indexed logs in AppSignal, you can generate metrics from them directly in the Explore view. Use these log-based metrics to track important signals over time, set up triggers, or add them to dashboards, all without changing your application code or leaving your log exploration workflow.

Use log metrics to count how often an event happens, track the latest value of a numeric field, or follow its average and percentiles over time.

When you spot something worth tracking in your logs, you can turn it into a metric without leaving the Logs page. The query, severity, and log source you've used to narrow your logs carry into the metric, so the filtering work you've already done is what defines what the metric tracks. Once the metric is saved, you can add it to a dashboard or use it in a trigger in the same flow.

Create a metric from a log line

The fastest way to create a metric is from a log line that already shows the data you want to track.

  1. Open the Logs page for your app.
  2. Use the query bar to filter the log lines that match the event you want to measure.
  3. Select a log line in the table to open the Log details panel.
  4. In the Actions section, select Create a metric.
  5. The Create metric overlay opens with the Log source, Severity, and Query fields prefilled from the log line.
Log details panel with the Create a metric action

Configure the metric

In the Define metric panel, fill in the fields that describe what you want to measure. As you change any field, the Data preview on the right updates so you can confirm the metric returns the data you expect.

  • Metric name: A unique name for the metric, used when you reference it on dashboards and triggers. See metric naming for the rules and recommendations.
  • Log source: The log source the metric draws events from.
  • Severity: Filter by severity, or select all to include every level.
  • Query: The query string used to match log lines. Same syntax as the Logs page.
  • Metric type: Count, Gauge, or Measurement. See metric types.
  • Field to measure: For Gauge and Measurement metrics, the numeric field to track — like the duration or size of each event, instead of counting occurrences.
  • Group by tag: Split the metric by a tag to get a separate series per unique value (for example, group by hostname to get one series per server).

When you finish, select Create metric to save.

Metric naming

We recommend naming your metrics something easily recognizable.

Metric names only support numbers, letters, dots and underscores ([a-z0-9._]) as valid characters. Any other characters will be replaced with an underscore by our processor.

Some examples of good metric names are:

  • database_size
  • account_count
  • users.count
  • notifier.failed
  • orders.request.duration

Note: We do not recommend adding dynamic values to your metric names like so: eu.database_size, us.database_size and asia.database_size. This creates multiple metrics that serve the same purpose. Instead we recommend using Group by tag for this.

Metric types

The metric type defines how AppSignal aggregates the data over time. The Field to measure field appears for Gauge and Measurement only, since Count just counts matching log lines.

Count

The total number of matching events in a given time frame. Use this for events like errors, sign-ups, or job retries.

Count does not require a Field to measure — it just counts every log line matching your query.

Create metric overlay with the Count chart preview

Gauge

The current value at the moment. Use this for values that move up and down, such as an active connection count.

Create metric overlay with the Gauge chart preview

Measurement

Averages, counts, and percentiles for a numeric field over time. Use this when the distribution matters, such as request duration.

Measurement persists the mean, count, and 90th/95th percentiles of the Field to measure for each interval.

Preview your metric

The Data preview panel has two tabs that let you confirm the metric returns the data you expect before saving.

Chart

A live chart of the metric for the selected time range. The chart preview supports selecting multiple log sources and severities, and updates as you change any field in the Define metric panel.

Use the time-range selector below the chart to switch between Last 24 hours, Last 48 hours, and Last 7 days.

Create metric overlay with the chart time-range selector open

Log lines

The log lines that match your current query. When a Field to measure is set, that field is shown as a highlighted column so you can confirm the values before saving.

Create metric overlay with the log lines preview

Choose what to do next

After you save a metric for the first time, AppSignal asks what you want to do with it:

  • Add to dashboard: Add the metric to a chart on an existing dashboard.
  • Create a trigger: Open the trigger creation flow with the metric prefilled.
  • Edit metric: Reopen the overlay to refine the configuration.

For follow-up metrics, AppSignal shows a confirmation toast instead. You can still reach the same options from the Metrics page.

A new metric may take a moment to start collecting data, so a dashboard or trigger created right after may briefly show a "no data yet" warning.

Edit a metric

  1. Open the Metrics page from the Logging side menu.
  2. Find the metric and select Edit from the three-dot menu.
  3. Adjust the Severity, Query, Field to measure, or Group by tag fields.
  4. Select Update metric to save.

The Metric name and Metric type are read-only when editing. To change either, create a new metric.

From the row menu on the Metrics page, you can also add the metric to a dashboard, create a trigger from it, or delete it. The Modified by column shows who last updated each metric, so you can see at a glance which team member made the most recent change.

Example: track request duration

  • Metric name: orders.request.duration
  • Log source: application
  • Query: path=/api/orders
  • Metric type: Measurement
  • Field to measure: duration_ms
  • Group by tag: hostname

This metric reports the average, count, and percentiles of duration_ms for requests to /api/orders, with one series per host.