home / containers / stern

stern

4.6k

Kubernetes log tailing CLI for streaming and filtering logs across multiple pods and containers.

$brew install stern
Language
Go
Stars
4,552
Category
Containers & K8s
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

stern is a Kubernetes log tailing CLI for following logs across multiple pods and containers that match a regex, selector, or workload resource. It is built for cluster debugging when replicas churn and one kubectl logs call is not enough.

What It Enables
  • Stream logs from all pods behind a deployment, service, job, or regex match and keep following as pods are added, restarted, or replaced.
  • Reduce noisy log streams by namespace, label or field selector, container name or state, node, and include, exclude, or highlight regex filters.
  • Emit structured log records or custom templates for piping into jq, shell scripts, or other triage and reporting workflows.
Agent Fit
  • --output json emits one JSON object per log line with pod, namespace, container, node, labels, and annotations, and --stdin reuses the same templating path for piped logs.
  • Resource queries like deployment/name, non-interactive flags, and automatic watch and retry behavior make it useful in inspect-then-filter incident loops.
  • It is inspection-only and depends on kubeconfig access plus live Kubernetes log APIs; the optional --prompt flow is interactive and not suitable for unattended runs.
Caveats
  • You need cluster credentials and log permissions in the target namespaces before stern can do anything useful.
  • Follow mode can open many concurrent log requests on busy workloads, so --max-log-requests may need tuning to avoid errors or excess load.