toUTC
unable to parse Kubernetes controller-runtime log timestamps
#297
Labels
kind/bug
Something isn't working
What happened:
Attempting to format the timestamp from the JSON structured logs of a Go-based Kubernetes controller (specifically external-secrets, but this shows the relevant format - https://kubernetes.io/blog/2020/09/04/kubernetes-1-19-introducing-structured-logs/#using-structured-logs) results in the incorrect date
What you expected to happen:
The timestamp, which is seconds past epoch but with milliseconds (?) after the decimal point, to be parsed by
toUTC
correctlyHow to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
The underlying bug appears to be in github.com/spf13/cast which converts the
json.Number
into atime.Time
by turning into a string before attempting to turn it into anint64
, which it assumes to be a whole number. Unfortunately, that repository has had much activity since February 2023.Environment:
stern --version
): Built from HEAD (c1649ca9f88f9183467dadda7cd8c0ffd16943e8
) to demo withstdin
flag, but also present in 1.28.0cat /etc/os-release
): Both macOS and Ubuntu 23.10The text was updated successfully, but these errors were encountered: