Skip to main content

/v1/logs/scroll


Rate Limiting

The Logs API enforces rate limiting to ensure optimal performance and resource allocation:

  • Daily Limit: 500 scroll queries per client id per day
  • Rate Reset: Limits reset at midnight UTC
  • Quota Increases: Contact CM Support for higher daily quotas if your use case requires additional capacity

Usage

The scroll API uses cursor-based pagination to retrieve logs in manageable chunks. Here's how it works:

  1. Initial Request: Make your first request to /v1/logs/scroll without a scroll_id parameter
  2. Token Response: The API returns a scroll_id token along with the first batch of logs and a has_more boolean
  3. Subsequent Requests: Use the returned scroll_id in your next request to get the next batch of logs
  4. Continue Scrolling: Repeat this process until has_more returns false, indicating no more logs are available

Each scroll token maintains your position in the dataset, ensuring you don't miss logs or receive duplicates even if new logs are added during your scrolling session.

Example Usage

import requests

# Initial request (no scroll_id)
initial_payload = {
"application": "atr",
"time_range": "now-1d"
# Optional fields: app_type, domain, size, filters, log_group, tenant, stage
}

headers = {
"Authorization": f"Bearer {jwt_token}",
"Content-Type": "application/json"
}

# First request
response = requests.post(
"https://central-monitoring-prod.mywizard-aiops.com/v1/logs/scroll",
json=initial_payload,
headers=headers
)

data = response.json()
logs = data["logs"]
scroll_id = data["scroll_id"]
has_more = data["has_more"]

# Subsequent requests using the scroll_id
while has_more:
subsequent_payload = {
"scroll_id": scroll_id # Only the scroll_id is needed for subsequent requests
}

response = requests.post(
"https://central-monitoring-prod.mywizard-aiops.com/v1/logs/scroll",
json=subsequent_payload,
headers=headers
)

data = response.json()
logs.extend(data["logs"]) # Add new logs to existing collection
scroll_id = data["scroll_id"] # Update token for next request
has_more = data["has_more"] # Check if more logs available