Do we need a timestamp in the log lines? As journalctl (in my case) adds its own timestamp.
Seems quite wasteful to ask for gettimeoday so often, for no apparent use (and log capture binaries are probably better at it)
In Kubernetes you can use the --timestamps option to show timestamps per line...
$ kubectl -n kube-system log coredns-57bf75fd78-4m66c --timestamps
2019-08-19T21:21:43.1740533Z .:53
2019-08-19T21:21:43.1742448Z 2019-08-19T21:21:43.173Z [INFO] plugin/reload: Running configuration MD5 = 0339c7ee4867a8b08b7018a9fba312fe
2019-08-19T21:21:43.1742768Z 2019-08-19T21:21:43.174Z [INFO] CoreDNS-1.6.2
2019-08-19T21:21:43.174386Z 2019-08-19T21:21:43.174Z [INFO] linux/amd64, go1.12.7, 86edb15c-dirty
2019-08-19T21:21:43.1744068Z CoreDNS-1.6.2
2019-08-19T21:21:43.1744254Z linux/amd64, go1.12.7, 86edb15c-dirty
[ Quoting notifications@github.com in "Re: [coredns/coredns] time in log l..." ]
In Kubernetes you can use the
--timestampsoption to show timestamps per line...$ kubectl -n kube-system log coredns-57bf75fd78-4m66c --timestamps 2019-08-19T21:21:43.1740533Z .:53 2019-08-19T21:21:43.1742448Z 2019-08-19T21:21:43.173Z [INFO] plugin/reload: Running configuration MD5 = 0339c7ee4867a8b08b7018a9fba312fe 2019-08-19T21:21:43.1742768Z 2019-08-19T21:21:43.174Z [INFO] CoreDNS-1.6.2 2019-08-19T21:21:43.174386Z 2019-08-19T21:21:43.174Z [INFO] linux/amd64, go1.12.7, 86edb15c-dirty 2019-08-19T21:21:43.1744068Z CoreDNS-1.6.2 2019-08-19T21:21:43.1744254Z linux/amd64, go1.12.7, 86edb15c-dirty
yep, see and with even more time resolution
I can understand the rationale behind this but, as a user of standalone coredns in a minimal environment, I would very much like to have timestamps on my log messages.
Would it be possible to add timestamps back in, but have them enabled with a --timestamps option inline with the Kubernetes example given above?
[ Quoting notifications@github.com in "Re: [coredns/coredns] time in log l..." ]
I can understand the rationale behind this but, as a user of standalone coredns
in a minimal environment, I would very much like to have timestamps on my log
messages.Would it be possible to add timestamps back in, but have them enabled with a
--timestamps option inline with the Kubernetes example given above?
no, this was a deliberate choice. Any setup that runs coredns should have logging and
metrics setup which will add these meta data bits (even stdout to syslog will do this for
you).
This is also a slippery slope, because after timestamps, people will want to log to files
and then request log-file rotation. Those things don't belong in an internet facing
daemon.
/close
/lock
Most helpful comment
In Kubernetes you can use the
--timestampsoption to show timestamps per line...