4

Team: All my container logs are under /var/log/containers..

Where in kubelet or docker config can I specify this path such that logs are instead created under new path? Ex : /shared ? Instead of /var/log

4
  • I can't find anything either. It's also the case with containerd runtime. Good point. If you can't figure it out, one way to go about this might be to mount-bind your /var/log/containers from your arbitrary logs directory - see serverfault.com/a/613184/293779 – SYN Dec 18 '20 at 12:25
  • @AhmFM could you specify why you want the change the log path? – c4f4t0r Dec 20 '20 at 0:17
  • 2
    Because I don’t like users writing to root directly. So I created a slice partition from root and want container logs to be written there instead. – AhmFM Dec 21 '20 at 6:43
  • You might circumvent this by using syslog, or other logging facility if you can configure the host and set up the log path there. – karatedog Jan 23 at 20:45
0

I got a work around to this case. basically, My root volume is 100GB and I created a separate partition out of it as 70GB and I set it to a new device sda3 and mounted it to /var/lib.

now, all docker container logs are written in same path but in backend they are mounted to a different drive. with this setup, even if there is disk pressure, the node does not become unavailable.

so my drive now looks liek below

sda1
sda2 / 30GB
sda3 /var/lib 70GB.  << new device

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.