Stream logs from a sandbox’s main process withDocumentation Index
Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
Use this file to discover all available pages before exploring further.
stream_logs(). This captures stdout/stderr from the command passed to Sandbox.run(). Output from exec() commands is not included (see the execution guide for Process.stdout/Process.stderr). Returns a StreamReader that yields log lines. Iterate synchronously or asynchronously.
Sandboxes created with the default command (
tail -f /dev/null) produce no log output. To use stream_logs(), pass a command that writes to stdout/stderr when calling Sandbox.run().Retrieve recent logs
Follow mode
Stream logs continuously, liketail -f. The iterator blocks until new data arrives.
Filter by time
Only retrieve logs after a specific timestamp.Timestamps
Prefix each line with an ISO 8601 timestamp from the server.Async iteration
Retrieving logs from stopped sandboxes
You can retrieve historical logs from sandboxes that have already completed, failed, or been terminated:follow=False (the default) is supported for stopped sandboxes.
What are container logs?
Container logs capture stdout and stderr from the sandbox’s main process (PID 1). Commands run withexec() produce output on their own streams (Process.stdout/Process.stderr), not container logs. To generate logs visible to stream_logs(), your sandbox command must write to stdout or stderr.
See also
- Command execution - Running commands and streaming their output with
exec() - Sync vs async - Iteration patterns