container_logs
Get container logs as a one-shot snapshot or bounded live tail, with options for line count, timestamps, and stream selection.
Instructions
Get the logs of a container: a one-shot snapshot by default, or a bounded live tail with follow=True.
Follow mode returns when limit_lines lines are collected, timeout_seconds elapses, or the
container exits, whichever comes first — so the agent can watch live output without blocking
forever. limit_lines/timeout_seconds apply only in follow mode; until only in snapshot mode.
Caveat for ssh:// daemons: docker-py can't cancel an SSH stream, so in follow mode the
timeout_seconds watchdog can't interrupt a fully silent container — use the snapshot mode
there if you need a hard time bound.
args:
id_or_name - The container id or name
stdout - Include stdout
stderr - Include stderr
timestamps - Include timestamps
tail - Number of lines from the end (default 200), or the literal "all" for everything
since - Only return logs created after this unix timestamp
until - Only return logs created before this unix timestamp (snapshot mode only)
follow - Follow the live log stream instead of returning a snapshot
limit_lines - Follow mode: max lines to collect before returning (default 200)
timeout_seconds - Follow mode: max wall-clock seconds before returning what was collected (default 30)
returns: str - Decoded log output (up to limit_lines lines in follow mode)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tail | No | ||
| since | No | ||
| until | No | ||
| follow | No | ||
| stderr | No | ||
| stdout | No | ||
| id_or_name | Yes | ||
| timestamps | No | ||
| limit_lines | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |