I’m trying to persist the logs of a container that is running inside a docker stack I’m deploying the whole thing to the swarm using a .yml file but every solution I come across either does not work or I have to set it up manually like everytime I deploy the stack I have to mount manually. What would be the best way to persist the logs automatically without having to do it manually everytime? (Without Kibana etc..).
2
Answers
Kubernetes Volumes can be referred to write the logs into persistent storage.
There are different solutions stacks for shipping, storing and viewing logs.
Deploy EFK stack in the container platform. FLuentd is run as daemonset collecting the logs from all the containers from a host and feeds to elasticsearch. Using kibana you can visualize the logs stored in elasticsearch.
With curator you can apply data retention policies depending on the amount of days you want to keep the logs.