If I start chaoskube with the --log-format=json in the log output there is a error:
./chaoskube --log-format=json --excluded-times-of-day="22:00-06:00" --excluded-weekdays=Sat,Sun --excluded-days-of-year=Apr1,Dec24 --labels="foo,bar" --kinds='!DaemonSet' --annotations='a.foo,a.bar'
{"dryRun":true,"interval":600000000000,"level":"info","maxRuntime":-1000000000,"msg":"starting up","time":"2024-02-18T11:15:37+01:00","version":"v0.31.0"}
{"level":"info","master":"https://127.0.0.1:6443","msg":"connected to cluster","serverVersion":{"major":"1","minor":"28","gitVersion":"v1.28.1+k3s1","gitCommit":"0d23cfe038ef22d7ca899764e9aaeea8a39d4874","gitTreeState":"clean","buildDate":"2023-09-08T17:15:00Z","goVersion":"go1.20.7","compiler":"gc","platform":"linux/arm64"},"time":"2024-02-18T11:15:37+01:00"}
{"annotations":[{},{}],"excludedPodNames":null,"includedPodNames":null,"kinds":[{}],"labels":[{},{}],"level":"info","maxKill":1,"minimumAge":0,"msg":"setting pod filter","namespaceLabels":null,"namespaces":null,"time":"2024-02-18T11:15:37+01:00"}
Failed to obtain reader, failed to marshal fields to JSON, json: error calling MarshalJSON for type time.Time: Time.MarshalJSON: year outside of range [0,9999]
{"level":"info","location":{},"msg":"setting timezone","name":"UTC","offset":0,"time":"2024-02-18T11:15:37+01:00"}
Also the parameter of the kinds, annotations, labels, ... are not shown in the log output.
The program is running fine, it is only the log output that has a error and thas not show all of the input parameters
If I start chaoskube with the --log-format=json in the log output there is a error:
Also the parameter of the kinds, annotations, labels, ... are not shown in the log output. The program is running fine, it is only the log output that has a error and thas not show all of the input parameters
With adding the
String()
method to the:and renaming the log field:
I was able to solve the issue, but I'm not sure if this approach is in the spirit of the inventor.