Reputation: 27
I am using a centos 7.9 for my docker. I'm running a C++ program in my docker image which writes logging via syslog. However, I cannot find these log anywhere when I run it in docker. On my centos machine, the logging would by default go to /var/log/messages, but on docker /var/log/messages is empty. I've tried setting the docker logging driver to syslog (in the docker run command) and I can see rsyslogd running in the docker container as well with ps -aux.
On my host machine, /var/log/syslog does not receive the logs either. How do I get the log files to write to the /var/log/messages on the docker environment (or to my host machine, if storing them on the docker environment is not advisable)? Thanks.
Upvotes: 0
Views: 626
Reputation: 358
Since docker does not support systemd, it's very likelly that syslog is not running on your container
My suggestion is... start a shell at your container make sure syslog is installed using
yum list --installed
or
rpm -qa
Them run the syslog daemon from the shell manually after that, start a new terminal and run your code
ps: since I'm on my phone, i can't be more helpful I'll try to edit it as soon as possible
Upvotes: -1