Repository navigation
Releases
v1.35.0
⚡ Notable Changes
A new --pager flag to pipe output into a pager
You can now pipe stern's output into a pager with the --pager flag. Unlike piping in the shell (stern --color=always backend | less -R), colors are preserved without any extra flags, and stern stops tailing when you quit the pager.
stern --pager less backend
The pager is used only when the standard output is connected to a terminal (tty). If you always want to use a pager, set it in the config file:
pager: lessDistinct colors for pods created by the same workload
Pods created by the same workload (e.g. replicas of a Deployment) are now assigned distinct colors as long as unused colors remain, so that their interleaved logs are easier to tell apart. Pods that do not share a workload with other pods keep the same colors as before.
Nested field extraction in extractJSONParts
extractJSONParts and tryExtractJSONParts now accept keys in dot notation to access nested fields.
stern --template='{{ extractJSONParts .Message "python.levelname" "message" }}{{"\n"}}' backend
The timestamp and the namespace in extjson and ppextjson
The extjson and ppextjson outputs now include the timestamp field when --timestamps is specified, and the namespace field when tailing multiple namespaces with --namespace. Nested JSON messages in ppextjson are now indented as well.
$ stern --timestamps -o extjson backend
{"pod":"backend-...","container":"backend","timestamp":"2026-10-01T10:00:00.123456789Z","message":"hello"}
⚠️ Breaking Changes
.Message no longer includes the timestamp with --timestamps
With --timestamps, the timestamp is no longer prepended to .Message in templates, so template functions that parse .Message as JSON now work with --timestamps. The timestamp is available as the new .Timestamp template variable. The output of the built-in default and raw templates is unchanged, but if you use a custom template with --timestamps, add .Timestamp to it to keep printing the timestamp.
stern --timestamps --template='{{.Timestamp}} {{.Message}}{{"\n"}}' backend
Changes
- fix: close config file after reading (#367) ee5b0b3 (Filip Boye-Kofi)
- fix: change errorf format to represent real value (#368) 0d39b3f (Filip Boye-Kofi)
- docs: fix "when if" typo in max-log-requests table (#371) 13b9806 (SEONGHYUN HONG)
- Keep .Message raw with --timestamps; expose timestamp as .Timestamp (#372) 8a00e61 (SEONGHYUN HONG)
- Support nested field extraction via dot notation in extractJSONParts (#373) 3dd605b (somaz)
- docs: list toUTC in README template functions (#378) 2926461 (Dean Chen)
- Fix misspelled identifiers reHightlight and stirngSlice (#382) 523c01a (MsfPablo)
- fix: honor --timestamps when reading from stdin (#380) 96b3c3a (Vincent)
- fix: include the namespace in extjson and ppextjson for multiple namespaces (#386) d6d42c9 (Ahmad Mehrabi)
- fix: preserve the sign of fractional Unix timestamps (#388) 6db257e (Haram Jeong)
- docs: fix the function name in the colorCustom example (#383) 050c9fe (Iain)
- Assign distinct colors to pods created by the same workload (#375) 74000c2 (Jojin)
- Add --pager flag to pipe output into a pager (#376) 4772306 (Jojin)
- Hide the namespace when --namespace repeats a single namespace (#389) b4b5d59 (Kazuki Suda)
- Update dependencies for Kubernetes 1.37 (#390) e62aec2 (Kazuki Suda)
- fix: show the timestamp in extjson and ppextjson output (#392) 5e330c6 (Spicy Shark)
- Marshal extjson and ppextjson outputs with encoding/json instead of string concatenation (#393) 7ef2365 (Kazuki Suda)
- fix: keep inline regexp flags within their own --highlight pattern (#395) 9a830a0 (Spicy Shark)
v1.34.0
⚡ Notable Changes
New --qps and --burst flags for client-side throttling
You can now control the rate of requests to the Kubernetes API server with --qps and --burst flags. This is useful when you are tailing many pods and want to avoid overwhelming the API server.
stern . --qps 10 --burst 20
Changes
v1.33.1
v1.33.0
⚡ Notable Changes
New template variables Labels and Annotations
You can now use Labels and Annotations in your templates.
stern -n kube-system -l component --template '{{printf "%-25s %s" .Labels.component .Message}}{{"\n"}}'
Changes
v1.32.0
⚡ Notable Changes
A new template function prettyJSON
You can now use a new template function prettyJSON that parse input and emit it as pretty printed JSON. If it parse fails output string as is.
# Will try to parse .Message as JSON and pretty print it, if not json will output as is
stern --template='{{ .Message | prettyJSON }}{{"\n"}}' backend
# Or with parsed json, will drop non-json logs because of `with`
stern --template='{{ with $msg := .Message | tryParseJSON }}{{ prettyJSON $msg }}{{"\n"}}{{end}}' backend
A new template function bunyanLevelColor
You can now use a new template function bunyanLevelColor that print bunyan numeric log level using appropriate color.
A new flag --condition
A new --condition allows you to filter logs with the pod condition on: [condition-name[=condition-value]. The default condition-value is true. Match is case-insensitive. Currently, it is only supported with --tail=0 or --no-follow.
# Only display logs for pods that are not ready:
stern . --condition=ready=false --tail=0
Changes
- Add
--condition(#276) 2576972 (Felipe Santos) - Add check for when
--no-followis set with--tail=0(#331) 276e906 (Felipe Santos) - Implement JSON pretty print (#324) ccd8add (Fabio Napoleoni)
- Fix descriptions of
extjsonandppextjson(#325) d9a9858 (Takashi Kusumi) - Allow
levelColortemplate function to parse numbers (#321) db69276 (Jimmie Högklint)
v1.31.0
v1.30.0
⚡ Notable Changes
Add support for configuring colors for pods and containers
You can now configure highlight colors for pods and containers in the config file using a comma-separated list of SGR (Select Graphic Rendition) sequences. See the "Customize highlight colors" section for details.
Example configuration:
# Green, Yellow, Blue, Magenta, Cyan, White
pod-colors: "32,33,34,35,36,37"
# Colors with underline (4)
# If empty, the pod colors will be used as container colors
container-colors: "32;4,33;4,34;4,35;4,36;4,37;4"Display different colors for different containers
A new --diff-container flag allows displaying different colors for different containers. This is useful when you want to debug logs for multiple containers in the same pod.
You can also enable this feature in the config file.
diff-container: trueChanges
v1.29.0
⚡ Notable Changes
A new --stdin flag for parsing logs from stdin
A new --stdin flag has been added, allowing parsing logs from stdin. This flag is helpful when applying the same template to local logs.
stern --stdin --template \
'{{with $msg := .Message | tryParseJSON}}{{toTimestamp $msg.ts "01-02 15:04:05" "Asia/Tokyo"}} {{$msg.msg}}{{"\n"}}{{end}}' \
<etcd.log
Additionally, this feature helps test your template with arbitrary logs.
stern --stdin --template \
'{{with $msg := .Message | tryParseJSON}}{{levelColor $msg.level}} {{$msg.msg}}{{"\n"}}{{end}}' <<EOF
{"level":"info","msg":"info message"}
{"level":"error","msg":"error message"}
EOF
Add support for UNIX time with nanoseconds to template functions
The following template functions now support UNIX time seconds with nanoseconds (e.g., 1136171056.02).
toRFC3339NanotoTUCtoTimestamp
Changes
- Add support for UNIX time with nanoseconds to template functions (#300) 0d580ff (Takashi Kusumi)
- Clarify that '=' cannot be omitted in --timestamps (#296) ac36420 (Takashi Kusumi)
- Added example to README (#295) c1649ca (Thomas Güttler)
- Update dependencies for Kubernetes 1.30 (#293) d82cc9f (Kazuki Suda)
- Add
--stdinforstdinlog parsing (#292) 53fc746 (Jimmie Högklint)
v1.28.0
⚡ Notable Changes
Highlight matched strings in the log lines with the highlight option
Some part of a log line can be highlighted while still displaying all other logs lines.
--highlight flag now highlight matched strings in the log lines.
stern --highlight "\[error\]" .
v1.27.0
⚡ Notable Changes
Add new template function: toTimestamp
The toTimestamp function takes in an object, a layout, and optionally a timezone. This allows for more custom time parsing, for instance, if a user doesn't care about seeing the date of the log and only the time (in their own timezone) they can use a template such as:
--template '{{ with $msg := .Message | tryParseJSON }}[{{ toTimestamp $msg.time "15:04:05" "Local" }}] {{ $msg.msg }}{{ end }}{{ "\n" }}'
Add generic kubectl options
stern now has the generic options that kubectl has, and a new --show-hidden-options option.
$ stern --show-hidden-options
The following options can also be used in stern:
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--cache-dir string Default cache directory (default "/home/ksuda/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--disable-compression If true, opt-out of response compression for all requests to the server
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
--server string The address and port of the Kubernetes API server
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
The number of kubectl generic options is so large that it makes it difficult to see stern's own list of options, so we usually hide them. Use --show-hidden-options if you want to list.

