Docker Community Forums

Share and learn in the Docker community.

Syslog driver to write log on the docker host is not working


(Othercode) #1

Hi there!

I’m trying to configure the docker to use syslog driver to send the logs from my Docker container (docker.io/centos 7) to the host.

docker run -d --log-driver syslog --log-opt syslog-address=udp://{hostname}:514 -p 8888:80 myapp

container configuration:

"LogConfig": {
      "Type": "syslog",
      "Config": {
          "syslog-address": "udp://{hostname}:514"
      }
  },

The host is configured to listen the incoming logs in port UDP 514…

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

Using the following command from inside the docker log correctly the message into the host syslog:

 logger --udp -p user.info -t myapp -n {hostname} -P 514 info some message!

But if I use syslog() and/or error_log() function of php from inside the container nothing happens…