Unbind
Logs

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.

GET
/logs/query

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
AuthorizationBearer <token>

Access token or API key (unb_...) passed as Authorization: Bearer <token>.

In: header

Query Parameters

type*LogType

Value in

  • "team"
  • "project"
  • "environment"
  • "service"
  • "deployment"
  • "build"
team_id*string
project_id?string
environment_id?string
service_id?string
deployment_id?string
search?string

Search expression: bare words (case-insensitive), "quoted phrases", AND/OR, -negation, @key:value for JSON fields

levels?string

Comma-separated log levels to include (debug, info, warning, error)

service_ids?string

Comma-separated service IDs to include (team/project/environment scope only)

start?string

Start time for the query

Formatdate-time
end?string

End time for the query

Formatdate-time
since?string

Duration to look back (e.g., '1h', '30m')

limit?integer

Number of log lines to get (mirrors loki.MaxQueryLimit)

Formatint64
Range1 <= value <= 2000
Default2000
direction?LokiDirection

Direction of the logs (forward or backward)

Value in

  • "forward"
  • "backward"
cursor?string

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"}