query
Run LogQL instant queries against Loki to evaluate metric expressions or log selectors at one point in time. Get a single value per series or a quick snapshot of current logs in raw JSON.
Instructions
Run a LogQL instant query against Loki, evaluating the expression at a single point in time.
Use this for metric expressions (rate, count_over_time, sum by) when one value per series is enough, or for a quick "what is happening right now" check. To read log lines across a time window, use query_range instead. To discover which labels exist before writing a selector, use labels and label_values.
Returns the raw Loki JSON response: {"status","data":{"resultType","result"}}, where resultType is "vector" for metric expressions and "streams" for log selectors. Read-only: it never writes to or mutates Loki.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | No | Evaluation timestamp, RFC3339 (2026-03-25T10:00:00Z) or Unix nanoseconds. Defaults to now. | |
| limit | No | Maximum log entries to return. Applies to log selectors only; metric expressions ignore it. Defaults to 100, must not exceed 5000. | |
| query | Yes | LogQL expression. Metric example: sum(rate({app="nginx"} |= "error" [5m])). Log example: {app="nginx"} |= "error". | |
| direction | No | Order of returned log entries: backward (newest first, the default) or forward (oldest first). |