Kubernetes for Developers
上QQ阅读APP看书,第一时间看更新

Timestamps

Timestamps are also available for the log output, although not by default. You can get the log messages prefixed by a timestamp by adding the --timestamps option. For example:

kubectl logs deployment/flask --timestamps

You then may see the following:

2017-09-16T03:54:20.851827407Z  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
2017-09-16T03:54:20.852424207Z * Restarting with stat
2017-09-16T03:54:21.163624707Z * Debugger is active!
2017-09-16T03:54:21.165358607Z * Debugger PIN: 996-805-904

It is worthwhile to note that the timestamps are from the hosts that are running the containers, not your local machine, so the time zone on those logs will often not be the same time zone in which you reside. The timestamps all include full-time zone detail (typically set to the UTC-0 time zone) so the values can be converted easily.