pod logs not stored in EKS nodes

Viewed 176

I am trying to configure a fluend to send logs to an elasticsearch. After configuring it, I could not see any pod logs in the elasticsearch.

While debuging what is happening, I have seen that there are no logs in the node in path var/log/pods:

cd var/logs/pods
ls -la
drwxr-xr-x. 34 root root 8192 Dec  9 12:26 .
drwxr-xr-x. 14 root root 4096 Dec  9 02:21 ..
drwxr-xr-x.  3 root root   21 Dec  7 03:14 pod1
drwxr-xr-x.  6 root root  119 Dec  7 11:17 pod2
cd pod1/containerName
ls -la
total 0
drwxr-xr-x. 2 root root  6 Dec  7 03:14 .
drwxr-xr-x. 3 root root 21 Dec  7 03:14 ..

But I can see the logs when executing kubectl logs pod1

As I have seen in the documentation logs should be in this path. Do you have any idea why there are no logs stored in the node?

1 Answers

I have found what was happening. The problem was related with the log driver. It was configured to send the logs to journald:

docker inspect -f '{{.HostConfig.LogConfig.Type}}' ID
journald

I have changed it to json-file. Now it is writing logs var/log/pods

Here there are the different logging configuration options

Related