Skip to main content
POST
/
query
/
logs
cURL
curl --request POST \
  --url https://us-east.metoro.io/api/v1/query/logs \
  --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"
      }
    }
  ]
}

Body

application/json

Query to execute to retrieve logs

Request to query logs

query
string
required

MetoroQL query to execute to retrieve logs.

startTime
integer
required

Unix timestamp in milliseconds to start querying logs from, inclusive. Shorter time ranges will lead to faster responses.

endTime
integer
required

Unix timestamp in milliseconds to stop querying logs at, inclusive. Shorter time ranges will lead to faster responses.

limit
integer

Maximum number of logs to return. Defaults to 100 if not provided. Must be between 1 and 1000.

Response

Logs retrieved successfully

Response containing logs matching the query, ordered by timestamp ascending

count
integer

Total number of logs matching the query

logs
object[]

List of logs matching the query, ordered

I