Add bns logs command for streaming container logs #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new top-level
bns logscommand that streams container application logs (stdout/stderr) from Kubernetes pods with support for multi-component streaming and multiple output formats.Key Features:
--environmentflag streams all components)--nameflag, repeatable)--follow,--tail,--since,--since-time,--timestamps,--previous[component/pod/container]Architecture:
bns execcommand (top-level utility command)Pods().GetLogs()APINew Files:
cmd/logs/root.go(524 lines) - Main command with component resolution and orchestrationpkg/k8s/kubectl/logs/logs.go(142 lines) - K8s log streaming wrapperpkg/k8s/kubectl/logs/multiplexer.go(377 lines) - Concurrent streaming coordinator with JSON/YAML writersModified Files:
cmd/utils/root.go- Register logs command alongside exec, git, etc.Usage Examples
Output Formats
Stylish (default):
JSON:
{"timestamp":"2026-01-17T23:54:32Z","component":"vote","componentId":"5qzDbeXOmg","pod":"vote-7c6d4d6b8-85k5h","container":"vote","namespace":"env-homi2s","message":"127.0.0.1 - - [17/Jan/2026 23:54:08] \"GET / HTTP/1.1\" 200 -"}YAML:
Test Plan
--component)--environment)--name, multiple names)--follow)--tail)--since)--timestamps)-o json)-o yaml)Tested with:
jqfor filteringNotes
🤖 Generated with Claude Code