DEV.co
Open-Source DevOps · stern

stern

Stern is a Go-based CLI tool for tailing logs from multiple Kubernetes pods and containers simultaneously, with color-coded output for easier debugging. It supports regex-based pod queries, automatic detection of new/deleted pods, and works across namespaces with flexible filtering options.

Source: GitHub — github.com/stern/stern
4.8k
GitHub stars
171
Forks
Go
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorystern/stern
Ownerstern
Primary languageGo
LicenseApache-2.0 — OSI-approved
Stars4.8k
Forks171
Open issues35
Latest releasev1.34.0 (2026-05-02)
Last updated2026-06-18
Sourcehttps://github.com/stern/stern

What stern is

Stern queries the Kubernetes API to stream logs from multiple pods/containers in parallel, applying regex filters to pod names, container names, and log lines. It supports multiple output formats (default, raw, JSON), custom templates, timestamp formatting, and field/label selectors for granular resource targeting.

Quickstart

Get the stern source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/stern/stern.gitcd stern# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multi-pod debugging in development/staging

Quickly tail logs across multiple instances of the same deployment or service without manual pod name entry. Ideal when investigating issues across horizontally-scaled applications.

Microservices troubleshooting

Correlate logs across services using regex patterns or label selectors. Watch related pods (e.g., all pods in a namespace or matching a pattern) simultaneously to trace request flows.

CI/CD and operational monitoring

Stream logs during deployments or job execution. Useful in automation scripts with configurable output formats (JSON, templates) and no-follow mode for one-shot log collection.

Implementation considerations

  • Requires kubeconfig access and appropriate RBAC permissions (get pods, get logs). Verify service account has log read permissions in target namespaces.
  • API throttling defaults to client-go behavior; tune --qps and --burst flags if hitting API rate limits during high-scale tailing (many pods/containers).
  • Output can be piped or templated; consider shell script wrappers for integration with alerting or log processing pipelines.
  • Configuration via YAML file (~/.config/stern/config.yaml) allows team standardization of flags like timestamps, colors, and max-log-requests.
  • Container/pod filtering uses regex; complex selection logic (multiple labels, field selectors) may require chained invocations or external filtering.

When to avoid it — and what to weigh

  • Requires persistent log storage/indexing — Stern is a real-time tailer, not a log aggregation platform. For long-term log retention, searching, or analysis, use dedicated solutions (ELK, Loki, Datadog).
  • Complex log correlation or alerting needed — Stern does not aggregate or correlate logs across services at scale, nor does it support alerting rules. Use centralized logging systems for enterprise-grade observability.
  • High-volume logging in large clusters — The API throttling and per-pod request limits may become a bottleneck. Consider log aggregation for production clusters with thousands of pods.
  • Non-Kubernetes environments — Stern is tightly coupled to Kubernetes API and resource types. Not applicable for non-K8s platforms.

License & commercial use

Stern is released under Apache License 2.0 (Apache-2.0), a well-established OSI-approved permissive license permitting commercial and proprietary use.

Apache-2.0 is permissive and explicitly permits commercial use, modification, and distribution provided original copyright and license notice are retained. Safe for commercial deployment without license review.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Stern requires read access to pod logs via Kubernetes API. Audit kubeconfig permissions and RBAC; restrict to least-privilege service accounts. No authentication/TLS customization in CLI flags; relies on kubeconfig config. No secrets-masking or log sanitization features; sensitive data in logs will be visible.

Alternatives to consider

kubectl logs (native)

Built-in kubectl command; requires manual pod enumeration and sequential tailing. No regex filtering or color coding. Lightweight but labor-intensive for multi-pod scenarios.

Lens IDE / k9s

GUI-based Kubernetes dashboards with integrated log viewers. Better for exploratory debugging but less suitable for automation and CI/CD pipelines.

Fluentd / Filebeat + ELK/Loki

Centralized log aggregation platforms. Required for long-term retention, full-text search, and cross-service correlation. Significantly more complex infrastructure.

Software development agency

Build on stern with DEV.co software developers

Stern accelerates log troubleshooting in Kubernetes environments. Install via Krew, Homebrew, or direct download and start tailing multiple pods instantly.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

stern FAQ

Does Stern store or persist logs?
No. Stern is a real-time tailer only. It streams logs from the Kubernetes API and does not persist them. For archival, use dedicated log aggregation systems or pipe output to a file/sink.
Can I filter logs by content, not just pod/container?
Yes. Use --include, --exclude, and --highlight flags with regex patterns to filter or highlight specific log lines. Combine with --template for custom formatting.
What RBAC permissions are required?
Minimally: 'get' and 'list' on pods, 'get' on pods/log. Namespace-scoped or cluster-wide depending on --all-namespaces usage. Exact permissions depend on your cluster RBAC policy.
Can Stern integrate with my CI/CD pipeline?
Yes. Use --no-follow to exit after logs shown, --output=json for machine-readable format, and pipe output to downstream tools. Suitable for deployment verification and log collection during test runs.

Software development & web development with DEV.co

Adopting stern is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source devops software in production.

Ready to streamline your Kubernetes debugging?

Stern accelerates log troubleshooting in Kubernetes environments. Install via Krew, Homebrew, or direct download and start tailing multiple pods instantly.