Skip to content

Commit 4be69d6

Browse files
Add bns logs command for streaming container logs (#72)
* Add bns logs command for streaming container logs Implement a new top-level 'bns logs' command that streams container application logs (stdout/stderr) from Kubernetes pods with support for multi-component streaming and multiple output formats. Features: - Stream logs from single or multiple components - Environment-wide log streaming (--environment flag) - Component filtering by ID or name (--name flag) - Context fallback support - kubectl-compatible flags (--follow, --tail, --since, --timestamps, etc.) - Thread-safe merged output from multiple sources - Color-coded prefixes for easy identification [component/pod/container] - Multiple output formats: stylish (default), JSON, YAML - Graceful error handling and signal interruption (Ctrl+C) New files: - cmd/logs/root.go - Main command implementation with component resolution - pkg/k8s/kubectl/logs/logs.go - K8s log streaming wrapper - pkg/k8s/kubectl/logs/multiplexer.go - Concurrent streaming coordinator Modified files: - cmd/utils/root.go - Register logs command Usage examples: bns logs --environment env-123 --follow --tail 100 bns logs --component comp-1,comp-2 --follow bns logs --environment env-123 --name api --name worker -o json bns logs --component comp-123 --since 5m --timestamps Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Fix: Remove exec command import (belongs to separate PR) * Fix duplicate Flags section in logs help output - Move examples from Long to Example field for proper Cobra formatting - Remove manual Flags documentation from Long field - Let Cobra automatically generate the Flags section - Improves help readability by eliminating duplication --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f9f9c73 commit 4be69d6

File tree

4 files changed

+1029
-0
lines changed

4 files changed

+1029
-0
lines changed

0 commit comments

Comments
 (0)