kubetail
tails logs from multiple pods simultaneously
TLDR
SYNOPSIS
kubetail [pod-pattern] [options]
DESCRIPTION
kubetail is a Bash script that aggregates and tails log output from multiple Kubernetes pods simultaneously. It matches pods by name prefix, regex, or label selector and streams their logs in a single terminal, using color-coded output to distinguish lines from different pods.The tool is useful when debugging distributed applications or microservices where related log entries are spread across several pod replicas. Under the hood, kubetail spawns multiple `kubectl logs --follow` processes and merges their output, optionally filtering by namespace, container, or duration.Defaults for most flags can be set via environment variables such as KUBETAILNAMESPACE, KUBETAILSINCE, KUBETAILTAIL, and KUBETAILCOLORED_OUTPUT.
PARAMETERS
PATTERN
Pod name pattern (prefix match by default, regex with --regex).-c, --container NAME
Container name (repeatable for multiple containers).-t, --context CONTEXT
Kubernetes context to use.-l, --selector SELECTOR
Label selector (e.g., app=myapp).-n, --namespace NAMESPACE
Target namespace.-e, --regex MODE
Match mode: regex or substring.-s, --since DURATION
Show logs since relative duration (e.g., 10m, 1h).-p, --previous BOOL
Retrieve logs from previous pod instances.-f, --follow BOOL
Follow log stream (default true).-d, --dry-run
Print matching pods/containers without tailing.-k, --colored-output MODE
Coloring mode: pod, line (default), loglevel, or false.-z, --skip-colors LIST
Comma-separated color indices to skip.-P, --prefix BOOL
Toggle pod name prefix on each line.-b, --line-buffered BOOL
Control line buffering.-j, --jq SELECTOR
Apply jq selector to JSON log lines.-r, --cluster NAME
Kubeconfig cluster name.--tail LINES
Limit number of recent lines per pod.--timestamps
Display timestamps on log lines.-i, --show-color-index BOOL
Display color index with pod prefix.-v, --version
Show version.-h, --help
Display help information.
CAVEATS
Third-party Bash script (not part of kubectl). Requires `kubectl` configured with cluster access. For Go-based alternatives with similar functionality, see stern.
HISTORY
kubetail was created by Johan Haleby to simplify tailing logs from multiple Kubernetes pods with a single command.
