'Redirect Docker container logs to host /var/log

Is there a configuration where we can automatically redirect a container's logs to a file in the host's /var/log/? We can access a containers logs using docker logs and on the host in /var/lib/docker/containers/<container id>/, but we want to access the logs in a file in /var/log/. We also want to preserve and append to this file if the container is recreated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source