
Grafana Query
CertifiedRun instant LogQL query in Loki
Grafana Query
Run instant LogQL query in Loki
Calls the /loki/api/v1/query endpoint at a single timestamp. Defaults to limit 100 and BACKWARD sort; time defaults to now.
type: io.kestra.plugin.grafana.loki.QueryExamples
Query current error rate
id: query_loki_instant
namespace: company.team
tasks:
- id: fetch_error_rate
type: io.kestra.plugin.grafana.loki.Query
url: http://localhost:3100
query: 'sum(rate({job="api"} |= "error" [5m]))'
limit: 100
Query metrics at a specific time
id: query_historical_metrics
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.grafana.loki.Query
url: https://loki.example.com
token: "{{ secret('LOKI_TOKEN') }}"
tenantId: team-a
query: 'sum(rate({namespace="production"}[10m])) by (level)'
time: "2024-01-01T12:00:00Z"
Query with authentication
id: query_metrics
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.grafana.loki.Query
url: https://loki.example.com
token: "{{ secret('LOKI_TOKEN') }}"
query: 'count_over_time({environment="staging"}[1h])'
direction: FORWARD
Properties
query *Requiredstring
LogQL query
Rendered LogQL expression sent to Loki (e.g., '{job="api"} |= "error"')
url *Requiredstring
Loki base URL
HTTPS endpoint of the Loki API, including scheme (e.g., http://localhost: 3100 or https://logs.example.com)
authToken string
Bearer token
Authorization header value for secured Loki deployments; render from secrets when possible
connectTimeout integerstring
30HTTP connect timeout
Connection timeout in seconds; defaults to 30
direction string
BACKWARDFORWARDBACKWARDSort direction
Use FORWARD for ascending timestamps or BACKWARD for descending; defaults to BACKWARD
limit integerstring
100Result limit
Maximum number of entries to return; defaults to 100
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
readTimeout integerstring
60HTTP read timeout
Read timeout in seconds; defaults to 60
tenantId string
Tenant ID
X-Scope-OrgID header used by multi-tenant Loki clusters
time string
Evaluation time
Timestamp for the instant query in nanoseconds or RFC3339; rendered from flow context. Defaults to current time.
Outputs
logs array
Query results
Entries include timestamp, labels, and either log line (streams) or value (vector/matrix)
resultType string
Result type
Type of result returned by Loki (vector, streams, or matrix)
Metrics
Records counter
Total number of log entries retrieved from Loki instant query