Fetch deployment logs
get_deployment_logsReturns CloudWatch logs from a live deployment's container. Supports time-range filtering (startTimeIso/endTimeIso), CloudWatch filter patterns (query), local multi-query diagnostics (queries), diagnosticPreset, noise suppression, and pagination (nextToken). Default limit is 500 lines, newest first. Use this to debug bot errors, check trading activity, or verify a strategy is running correctly. For failed/stalled deployments, prefer diagnosticPreset="broker_order_failure" or diagnosticPreset="runtime_failure" with contextLines=5-10 and limit near 1000 before concluding root cause. A single newest-first page or one warning line is not conclusive when nextToken is present or deprecation warnings dominate the page.
diagnosticPreset values: broker_order_failure searches broker/order rejects, permission failures, Alpaca 403/40310000, and tracebacks; runtime_failure searches crashes, imports, dependency/build failures, kills, and exceptions; startup searches startup/stream/broker initialization; orders searches order/fill/cancel/reject activity. Prefer queries for multiple explicit regex searches in one call when diagnosis needs more than one angle. A good deployment-failure call uses at least three bounded queries: errors/exceptions/tracebacks, broker/order/fill/reject/position activity, and startup/runtime/strategy lines. This avoids wasting turns on one narrow search and makes missing evidence more meaningful. The response includes perQuery match counts, totalLines, scannedLines, returnedLines, scannedStart/scannedEnd timestamps when visible, noiseSuppressedLines, truncatedQueryCount, and paginationWarning when more pages may need checking. Broad queries are capped; if truncatedQueryCount is nonzero, run a narrower follow-up query.
Pass contextLines (0-50) together with query to get grep-style output — only lines matching the pattern plus N surrounding lines on each side, -- between non-contiguous groups. When contextLines is set, the CloudWatch-side filter is suppressed and filtering runs locally on the raw fetched window so surrounding lines are preserved (CloudWatch's filterPattern strips context). query is treated as a JavaScript regex (case-insensitive), with a literal-substring fallback if the regex is invalid. The response also includes totalLines, returnedLines, and matchCount so you know how much was filtered.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | ||
| limit | No | ||
| query | No | ||
| queries | No | ||
| nextToken | No | ||
| endTimeIso | No | ||
| contextLines | No | ||
| deploymentId | Yes | ||
| startTimeIso | No | ||
| suppressNoise | No | ||
| diagnosticPreset | No |