Containers: Stream container stdout/stderr to Workers Observability logs #13171
alexminza
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the solution
Summary
Container stdout/stderr from processes started via
sandbox.startProcess()should be continuously forwarded to Workers Observability (dashboard logs,wrangler tail), similar to howconsole.log()in Workers is captured automatically.Current behavior
console.log()in the Worker → visible in Workers Observability ✅observability.logs.enabled: truein container config captures Sandbox runtime logs, but not stdout/stderr from user processesprocess.getLogs()returns a point-in-time snapshot — no streaming, no event subscription, no incremental readsWorkarounds
GET /debug/logsendpoint — Worker route that callsprocess.getLogs()on demand and returns stdout/stderr as JSON. Requires manual polling.wrangler containers ssh <instance-id>) — interactive access, not suitable for monitoring.getLogs()periodically and forwards viaconsole.log(). ButgetLogs()returns the full buffer each time with no offset/cursor, making incremental forwarding difficult.None of these provide real-time, continuous log visibility comparable to what
docker logs -for platform-managed containers offer.Proposed solution
Any of these would address the gap:
startProcess()processes automatically appears in Workers Observability whenobservability.logs.enabled: trueprocess.onLog(callback)orprocess.streamLogs()returning aReadableStreamthat the Worker can consume and forward viaconsole.log()process.getLogs({ since: timestamp })orprocess.getLogs({ offset: byteOffset })to enable efficient polling without re-reading the full bufferOption 1 would be the most ergonomic — zero Worker code needed.
Use case
Running any app inside a Cloudflare Container via the Sandbox SDK. The app produces structured logs on stdout that are essential for debugging issues, failures, and configuration problems. Currently these logs are invisible unless you SSH into the container or build a custom polling endpoint.
Environment
wrangler4.76.0@cloudflare/sandbox(latest)sandbox.startProcess()with a custom entrypointBeta Was this translation helpful? Give feedback.
All reactions