Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Stern

$ stern Community Low Risk
Stern · Cloud & Infra · Apache-2.0 · macos / linux / windows

Stern (stern) tails logs across multiple Kubernetes pods and containers simultaneously using regex pod matching, label selectors (-l), and namespaces (-n). Passing -o json (or -o raw), --no-follow, and --since enables bounded, machine-parseable log retrieval for agents.

FCRS-1.0 Score
82 /100
Good
Medium Confidence
Zero-Friction Install
brew install stern
CLI vs MCP Decision CLI Preferred vs MCP

stern aggregates multi-pod logs with regex, --since, --tail, and -o json in one command—much cleaner than multi-call kubectl or MCP log loops.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 20 / 25

Supports -o json, --color never, --no-follow, --since, and --tail, though forgetting --no-follow leaves the process streaming forever.

  • Supports -o json, -o raw, --color never, and --no-follow
  • Follows logs indefinitely unless --no-follow is specified
Trust & Safety 23 / 25

Strictly read-only log viewer with namespace (-n) and context (--context) scoping, though application logs may contain sensitive runtime data.

  • Read-only Kubernetes Pod/log API access only
Setup & Portability 14 / 15

Single static Go binary available via Homebrew, Krew, go install, and GitHub releases on macOS, Linux, and Windows.

  • Zero-dependency Go binary via brew install stern
Utility & Efficiency 11 / 15

Dramatically reduces boilerplate when gathering logs from multi-replica Deployments compared to kubectl logs.

  • Regex pod matching + label selectors + Go template parsing (--template)
Maintenance & Lineage 7 / 10

Community-maintained continuation (stern/stern) under Apache-2.0 license.

  • Active stern/stern repository under Apache-2.0
Docs & Verifiability 7 / 10

Clear README flag tables and --help output.

  • Documented in GitHub README and stern --help

Security, Auth & Guardrails

Auth Modes
Config File
Credential Storage

Reads standard kubeconfig (~/.kube/config, KUBECONFIG, --context) for read-only Pod log streaming.

Side Effects
Read-Only
Cost & Quotas

Apache-2.0 open-source CLI; free read-only cluster log utility.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Stern Agent Rules
- ALWAYS pass `--no-follow` alongside `--since` or `--tail` so `stern` exits instead of streaming indefinitely.
- Pass `-o json` and `--color never` when parsing pod logs programmatically.

Agent-Ready Command Recipes

Safe Read-Only Queries

Fetch recent logs across matching pods as JSON without blocking
stern "api-.*" -n prod --since 10m --tail 50 --no-follow -o json --color never

Grabs the last 50 log lines within 10 minutes as JSON objects and exits immediately.

Filter logs by Kubernetes label selector
stern . -l app=worker --since 5m --no-follow -o raw

Collects raw log messages from pods matching app=worker.

Strengths for Agents

  • + -o json --no-follow --since 10m --tail 50 returns clean, bounded JSON log records.
  • + 100% read-only across multi-replica pods and multi-container workloads.
  • + Built-in --template JSON parsing helpers (parseJSON, tryParseJSON).

Caveats & Pitfalls

  • ! Streams continuously by default—omitting --no-follow will hang agent command calls until timeout.
  • ! Large --tail or unbounded regex matches can flood context windows quickly.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI