countLogs
countLogsRuns LogQL queries against Loki to report matching line amounts without transmitting every raw message. Returns single figures or separated groups based on requested labels and fixed-size periods.
Instructions
Count log lines matching a LogQL log query without returning those lines. Example: query={app="backend"} |= "ERROR", groupBy="time". Omit groupBy for one total, use a label for values, time for buckets, or app,time for both; step="1d" sets the bucket width. For a multi-day label count, query one-day windows separately; only time-only buckets allow seven days by default. A named LogQL regexp capture can supply a groupBy label; inspect matching lines with queryLogs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Window end, default now. Use the end in a queryLogs footer to read older lines. | |
| step | No | Bucket width for time grouping, 1s through 1d; default automatic | |
| query | Yes | LogQL log query, e.g. {app="backend"} |= "ERROR". Take label names and values from discoverLogs. | |
| start | No | Window start, default now-1h. Examples: now-15m, now-2d, 2026-09-13T10:00:00+03:00. | |
| groupBy | No | Label name, time, or <label>,time | |
| connection | Yes | Connection name from listConnections |