Skip to content

Added Sandbox-Level Log Aggregation and Viewing Support#18

Merged
yulmwu merged 3 commits into
mainfrom
feat/sandbox-logs
Jun 5, 2026
Merged

Added Sandbox-Level Log Aggregation and Viewing Support#18
yulmwu merged 3 commits into
mainfrom
feat/sandbox-logs

Conversation

@yulmwu

@yulmwu yulmwu commented Jun 5, 2026

Copy link
Copy Markdown
Member

Previously, logs could only be viewed on a per-container basis within a sandbox. This PR introduces the ability to view logs aggregated across the entire sandbox.

The following sbxlet and sbxorch APIs have been added:

  • sbxlet GET /v1/sandboxes/{id}/logs
  • sbxorch GET /api/v1/nodes/{id}/sandboxes/{sandboxId}/logs

With this change, aggregated sandbox logs can be viewed using:

sbxctl logs s/<sandbox-id>

Logs are merged and displayed in chronological order by parsing RFC3339Nano timestamps from the CRI log format.

[app-a] 2026-06-05T11:00:02.110120282+09:00 stdout F Hello from app-a
[app-b] 2026-06-05T11:00:02.400570709+09:00 stdout F Hello from app-b
[app-a] 2026-06-05T11:00:05.128250929+09:00 stdout F Hello from app-a
[app-b] 2026-06-05T11:00:05.419319886+09:00 stdout F Hello from app-b

Additionally, pagination support for log output has been removed.

The decision was made because pagination introduced unnecessary operational and implementation overhead while providing limited practical value.

For more details, please refer to the API documentation and the changes included in this PR.

@yulmwu yulmwu added the enhancement New feature or request label Jun 5, 2026
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yulmwu

yulmwu commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

The sbxctl logs command has been updated to output only log entries instead of the full API response.

Additionally, a new -w (--watch) option has been added, allowing logs to be continuously monitored. When enabled, log output is refreshed at 1-second intervals.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds sandbox-level aggregated log retrieval (merged across containers and ordered by CRI RFC3339Nano timestamps) and wires it through sbxlet → sbxorch proxy → sbxctl, while removing cursor/limit pagination from the logs APIs.

Changes:

  • Added GET /v1/sandboxes/{id}/logs (sbxlet) and GET /api/v1/nodes/{id}/sandboxes/{sandboxId}/logs (sbxorch) for sandbox-wide aggregated logs.
  • Removed cursor/limit pagination from container logs endpoints and updated clients/tests/docs accordingly.
  • Updated sbxctl logs to support sandbox-level logs by default (optional container), with a polling --watch mode.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sandboxd-orch/http/router.go Adds sandbox logs proxy route
sandboxd-orch/http/handlers/handler.go Implements NodeSandboxLogs handler
sandboxd-orch/http/handlers/handler_api_test.go Exercises new proxy endpoint
sandboxd-orch/docs/orchestrator_swagger.yaml Documents new proxy API
sandboxd-orch/docs/orchestrator_swagger.json Regenerates swagger JSON
sandboxd-orch/docs/orchestrator_docs.go Regenerates embedded swagger
sandboxd-orch/client/sandboxes.go Adds GetSandboxLogs client call
sandboxd-orch/client/client_test.go Tests new client path building
sandboxd-let/sandbox/logs.go Implements aggregation + removes pagination
sandboxd-let/sandbox/logs_test.go Adds aggregation/sorting tests
sandboxd-let/http/router.go Adds sbxlet sandbox logs route
sandboxd-let/http/handlers.go Adds handler; updates container logs
sandboxd-let/http/dto.go Adds SandboxLogsResponse DTO
sandboxd-let/docs/sandboxd_swagger.yaml Documents new sbxlet endpoint/schema
sandboxd-let/docs/sandboxd_swagger.json Regenerates swagger JSON
sandboxd-let/docs/sandboxd_docs.go Regenerates embedded swagger
sandboxd-ctl/cmd/root.go Updates global flag help text
sandboxd-ctl/cmd/resource_cmds.go Updates logs command + --watch
sandboxd-ctl/cmd/output.go Adds log line extraction helper
sandboxd-ctl/client/orchestrator.go Adds NodeSandboxLogs client call
README.md Updates CLI/docs for new logs behavior
docs/sandboxd.md Documents sandbox logs endpoint
docs/orchestrator.md Documents sandbox logs proxy endpoint
Files not reviewed (2)
  • sandboxd-let/docs/sandboxd_docs.go: Language not supported
  • sandboxd-orch/docs/orchestrator_docs.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sandboxd-let/sandbox/logs.go Outdated
Comment thread sandboxd-let/sandbox/logs.go
Comment thread sandboxd-ctl/cmd/resource_cmds.go
Comment thread sandboxd-let/sandbox/logs.go
@yulmwu yulmwu merged commit 20cf64f into main Jun 5, 2026
2 checks passed
@yulmwu yulmwu deleted the feat/sandbox-logs branch June 5, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants