concept log entry in category kubernetes

appears as: log entries, log entry, log entries, The log entry
Learn Kubernetes in a Month of Lunches

This is an excerpt from Manning's book Learn Kubernetes in a Month of Lunches.

You can see from my output in figure 2.17 that Kubernetes just relays log entries exactly as they come from the container runtime.

Kubernetes has a very simplistic approach to log management - it collects log entries from the container runtime and stores them as files on the node running the container. If you want to do anything more advanced then you need to deploy your own log management system, and fortunately you have a world-class container platform to run it on. The moving pieces of the logging system collect logs from the nodes, forward them to a centralized store and provide a UI to search and filter them. Figure 13.1 shows the technologies we'll use in this chapter.

Figure 13.1 Logging in Kubernetes uses a collector like Fluentd to read the log files from the node

Nodes store log entries exactly as they come from the container, using filenames which include the namespace, pod and container names. The standard naming system makes it easy for the log collector to add metadata to the log entries to identify the source - and because the collector runs as a Pod itself, it can query the Kubernetes API server to get even more details. Fluentd adds Pod labels and the image tag as additional metadata, which you can use to filter or search the logs.

You can see from my output in figure 13.7 that a lot more data is coming through Fluent Bit - the log entry is the same but it's been enriched with the details of the source of the log. The Kubernetes filter fetches all that data from the API server. That gives you the additional context you really need when you're analyzing logs to track down issues - seeing the image hash for the container will let you check the software version with complete certainty.