stern templates expose timestamps as .Timestamp
Introduced 2026-10-22 · score 0.90
HOW TO USE IT
When a custom template uses `--timestamps`, read the raw log from `.Message` and include `.Timestamp` separately if you want to print the timestamp.
stern --timestamps --template='{{.Timestamp}} {{.Message}}{{"\n"}}' <pod-query>WHY THIS HELPS
When parsing JSON in custom templates while including timestamps, read the log message without a prepended timestamp and print the timestamp separately.
BEFORE THIS CHANGE
With `--timestamps`, `.Message` included the timestamp; a custom template could print `.Message` directly to include it.
REQUIREMENTS AND LIMITATIONS
- Version: v1.35.0
- --timestamps: Print timestamps; without a value, the default format is used.
- --template: Go template used for each log message.
- .Message: Log message without the prepended timestamp when `--timestamps` is used.
- .Timestamp: Timestamp string; empty unless `--timestamps` is set.
- The built-in `default` and `raw` templates have unchanged output.
FIRST-PARTY EVIDENCE
- https://github.com/stern/stern/releases/tag/v1.35.0
- https://github.com/stern/stern/blob/master/README.md
Check the installed version and the source before using it. Entry JSON