Application monitoring uses logs to inspect events and diagnostic messages emitted by a running process. Containerized applications usually write to standard output (stdout) and standard error (stderr) instead of managing log files themselves. section 5.3.2
The container runtime intercepts this output, stores it consistently, and makes it available without requiring knowledge of the application’s internal file locations. Kubernetes exposes the container log through kubectl logs. section 5.3.2
Use kubectl logs to inspect application behavior:
- Run kubectl logs kiada to display a pod’s container log. section 5.3.2
- Add -f or --follow to stream new log lines while requests arrive. section 5.3.2
- Add --timestamps=true to display the timestamp attached to every logged line. section 5.3.2
- Use --since=2m, --since-time=<timestamp>, or --tail=10 to restrict the displayed output. section 5.3.2
Follow requests as they arrive
Run kubectl logs kiada -f, send requests to the application, and observe entries such as “Received request for / from …”. Press Ctrl-C to stop streaming.
$ kubectl logs kiada --timestamps=true 2020-02-01T09:44:40.954641934Z Kiada - Kubernetes in Action Demo Application 2020-02-01T09:44:40.954843234Z --------------------------------------------- 2020-02-01T09:44:40.955032432Z Kiada 0.1 starting... 2020-02-01T09:44:40.955123432Z Local hostname is kiada 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 ...
Inspect timestamped startup and request entries to correlate application activity with time. section 5.3.2







































