Query Logs
Query historical logs for a team, project, environment, service, or deployment. Send the ID of the level named by type along with the IDs of every level above it. The deployment and build types need service_id and deployment_id.
Query historical logs for a team, project, environment, service, or deployment. Send the ID of the level named by type along with the IDs of every level above it. The deployment and build types need service_id and deployment_id.
Authorization
bearerAuth Access token or API key (unb_...) passed as Authorization: Bearer <token>.
In: header
Query Parameters
Value in
- "team"
- "project"
- "environment"
- "service"
- "deployment"
- "build"
Search expression: bare words (case-insensitive), "quoted phrases", AND/OR, -negation, @key:value for JSON fields
Comma-separated log levels to include (debug, info, warning, error)
Comma-separated service IDs to include (team/project/environment scope only)
Start time for the query
date-timeEnd time for the query
date-timeDuration to look back (e.g., '1h', '30m')
Number of log lines to get (mirrors loki.MaxQueryLimit)
int641 <= value <= 20002000Direction of the logs (forward or backward)
Value in
- "forward"
- "backward"
Pagination cursor from a previous response; returns strictly older logs (backward direction only)
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/logs/query?type=team&team_id=string"{ "data": [ { "level": "debug", "message": "string", "metadata": { "deployment_id": "string", "environment_id": "string", "project_id": "string", "service_id": "string", "team_id": "string" }, "pod_name": "string", "timestamp": "2019-08-24T14:15:22Z" } ], "next_cursor": "string"}