POST
/
query
/
logs
curl --request POST \
  --url https://us-east.metoro.io/api/v1/query/logs \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "query": "count(logs{log_level=\"error\", service.name=\"/k8s/default/redis-test-app\"})",
  "startTime": 1750147200000,
  "endTime": 1750150800000,
  "limit": 1000
}'
{
  "count": 2,
  "logs": [
    {
      "timestamp": 1750147200000,
      "log_level": "error",
      "message": "Error connecting to Redis",
      "attributes": {
        "service.name": "/k8s/default/redis",
        "container.id": "/k8s/default/redis-test-app-7f76f54f-2k8vx/redis-test-app",
        "environment": "production",
        "custom.attribute": "value"
      }
    },
    {
      "timestamp": 1750147260000,
      "log_level": "error",
      "message": "Terminating Redis connection",
      "attributes": {
        "service.name": "/k8s/default/redis",
        "container.id": "/k8s/default/redis-test-app-7f76f54f-2k8vx/redis-test-app",
        "environment": "production",
        "custom.attribute": "value"
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Query to execute to retrieve logs

Request to query logs

Response

200
application/json

Logs retrieved successfully

Response containing logs matching the query, ordered by timestamp ascending