Query logs from Grafana Loki at a single point in time
Execute instant LogQL queries against Loki at a specific point in time. This endpoint is primarily used for metric-type LogQL queries and returns vector results.
type: "io.kestra.plugin.grafana.loki.Query"Examples
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
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
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
The LogQL query to execute (e.g., '{job="api"} |= "error"')
url *Requiredstring
Loki base URL
The base URL of your Loki instance (e.g., http://localhost: 3100 or https://logs.example.com)
authToken string
Authentication token
Bearer token for authentication if Loki is secured
connectTimeout integerstring
30Connection timeout
HTTP connection timeout in seconds
direction string
BACKWARDFORWARDBACKWARDDirection
Determines the sort order of logs. Use FORWARD for ascending order, or BACKWARD for descending order. Defaults to BACKWARD.
limit integerstring
100Limit
Maximum number of entries to return
readTimeout integerstring
60Read timeout
HTTP read timeout in seconds
tenantId string
Grafana Loki Tenant ID
X-Scope-OrgID header value for multi-tenant Loki setups
time string
Evaluation time
The evaluation time for the query as a nanosecond Unix epoch or another supported format (e.g., RFC3339). Defaults to now.
Outputs
logs array
List of query results
Each entry contains timestamp, labels, and either log line (for stream results) or value (for vector/matrix results)
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