Kubernetes log tailing CLI for streaming and filtering logs across multiple pods and containers.
$brew install stern
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 jsonemits one JSON object per log line with pod, namespace, container, node, labels, and annotations, and--stdinreuses 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
--promptflow 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-requestsmay need tuning to avoid errors or excess load.