concept timestamp in category kubernetes

appears as: timestamp, timestamps
Kubernetes in Action, Second Edition

This is an excerpt from Manning's book Kubernetes in Action, Second Edition.

Now send some additional requests to the application and have a look at the log. Press ctrl-C to stop streaming the log when you’re done.

Displaying the timestamp of each logged line

You may have noticed that we forgot to include the timestamp in the log statement. Logs without timestamps have limited usability. Fortunately, the container runtime attaches the current timestamp to every line produced by the application. You can display these timestamps by using the --timestamps=true option, as shown in the next listing.

Listing 5.5 Displaying the timestamp of each log line
$ kubectl logs kubia –-timestamps=true
2020-02-01T09:44:40.954641934Z Kubia server starting...
2020-02-01T09:44:40.955123432Z Local hostname is kubia
2020-02-01T09:44:40.956435431Z Listening on port 8080
2020-02-01T09:50:04.978043089Z Received request for / from ...
2020-02-01T09:50:33.640897378Z Received request for / from ...
2020-02-01T09:50:44.781473256Z Received request for / from ...
Tip