Forrest logo
tool overview
On this page you find all important commands for the CLI tool stern. If the command you are looking for is missing please ask our AI.

stern

Stern is a command line tool used primarily for tailing logs in Kubernetes clusters. It is designed to help developers debug issues and monitor the logs of multiple containers running on different pods within a cluster.

Using stern, you can tail logs from multiple pods at the same time, making it useful for debugging distributed applications or microservices architectures.

The tool has a simple and intuitive syntax, allowing you to specify the pod or deployment name along with other options such as container name, namespace, or filtering by regex pattern.

Stern has various color-coded log levels, making it easy to distinguish between different types of log messages. It also supports following logs across pod restarts or rescheduling, ensuring you don't miss any important information.

You can also display timestamps with each log entry, helping in correlating events across different pods or containers. Additionally, stern allows you to exclude or include specific log lines based on custom regular expressions.

It has several output formats, including raw, json, or structured, enabling integration with other tools or pipelines. Moreover, stern supports scaling and filtering logs based on pod labels, making it flexible for different use cases.

It is an open-source tool, written in Go, and actively maintained by the community. Stern provides a convenient way to monitor and troubleshoot logs in Kubernetes, improving the development and debugging experience for Kubernetes applications.

List of commands for stern:

  • stern:tldr:2620e stern: Tail matched pods from 15 minutes ago.
    $ stern ${pod_query} --since ${15m}
    try on your machine
    explain this command
  • stern:tldr:45be1 stern: Tail all pods with a specific status.
    $ stern . --container-state ${select}
    try on your machine
    explain this command
  • stern:tldr:5d493 stern: Tail matched pods from all namespaces.
    $ stern ${pod_query} --all-namespaces
    try on your machine
    explain this command
  • stern:tldr:9036a stern: Tail all pods within a current namespace.
    $ stern .
    try on your machine
    explain this command
  • stern:tldr:a18a9 stern: Tail matched pods with a specific label.
    $ stern ${pod_query} --selector ${release=canary}
    try on your machine
    explain this command
tool overview