Last updated: April 16, 2026
Examples - Log Queries
Log-related metrics fall into the following categories, each backed by a different PromQL pattern:
- Log count is a raw counter — queries use
increase()to return the total number of log records accumulated over the selected interval. A> 0guard is appended to suppress empty intervals from the chart. - Log rate measures how fast log records are arriving — queries use
rate()to return log records per second, which is more useful for alerting because it is not affected by the length of the time window.
The examples below show the base query for each metric with no filters or Group by applied. When you add filters or select a Group by attribute in the Query Builder, the generated PromQL will include the corresponding label matchers and by clause automatically.
| Metric | What it measures | When to use it |
|---|---|---|
| Log count | Total number of log records produced across all services in the selected time window. | Use to understand absolute log volume and detect sudden spikes in output — for example, a sharp increase in error or warning records after a deployment. |
Example:sum(increase({otel_metric_name="dash0.logs"}[$__interval])) > 0The > 0 guard suppresses intervals with no log records, removing empty data points from the chart. | ||
| Log rate | Number of log records arriving per second across all services, averaged over the selected time window. | Use for alerting on log throughput — unlike log count, the value is not inflated by a longer time window, making thresholds easier to reason about and reuse across different interval lengths. |
Example:sum(rate({otel_metric_name="dash0.logs"}[$__interval])) | ||