The query endpoint
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
org_id | string | ✅ | Your tenant id (from login). |
language | string | ✅ | sql or promql. |
statement | string | ✅ | The query text. |
time_range | object | ✅ | { "start": <us>, "end": <us> } — microseconds since epoch. |
stream | object | — | { "name": "app", "stream_type": "logs" }. stream_type ∈ logs/metrics/traces/enrichment. |
limit | integer | — | Row cap. |
Response
The response carriesrows, columns, scanned_rows, took_ms, and cache_hit.
Send
Accept: application/x-ndjson to stream results row-by-row. Streaming bypasses the
query_result cache.SQL
trace_id:
PromQL
Setlanguage: "promql" to run a PromQL subset over metric streams. Supported today:
rate,increasesum,avg,min,max,count— withby/withouthistogram_quantile
PromQL coverage is a growing subset, not the full language. Check the in-repo
docs/promql_subset.md for the current support matrix.Search around an event
To pull the N events immediately before and after a given one (log context view), usePOST /api/v1/query/search_around with event_timestamp_us, stream, stream_type, and optional
before / after counts (default 50 each).
Caching
Queries flow through a 3-level cache —file_meta, parquet_meta, and query_result — plus a
parquet disk cache enabled by default (./data/cache/parquet, 10 GB LRU). The cache_hit field in
the response tells you whether the result came from cache.