Kubernetes log location in pod Kubernetes log location in pod kubernetes kubernetes

Kubernetes log location in pod


If your application is writing logs to file, then the location of that log file within the container depends on your application. The location of the log file on the host depends on whether you've mounted the log directory on the host.


If your application is writing logs to stdout, then your container runtime would capture each line and store it on the host. For Docker, this is stored in the /var/lib/docker/containers directory.

But Kubernetes also makes it easier for you to find the log files on the Kubernetes node, by symlinking the relevant log file to /var/log/pods/<namespace>_<pod_name>_<pod_id>/<container_name>/.


It's impossible to answer your question, because no one other than you knows how your application configured and deployed.

I can only guess your application writes logs to stdout via Docker json logging driver and your logs are stored on the one of your k8s nodes:

$ sudo find /var/lib/docker/containers -name "*-json.log"

By default you can find pod's logs with kubectl -n <namespace> logs <pod_name> command

More info: https://kubernetes.io/docs/concepts/cluster-administration/logging/


The log file in your containers depend on the application you are running, different applications output logs to different location, for instance, the tomcat in my environment output logs into /usr/local/tomcat/logs directory.

The logs of pod, we mean console output here, will be saved into a container directory in your host, then linked to /var/log/pods/$pod_name directory, you can find logs there.