This message shows that your installation appears to be working correctly. Now let’s check if the hello-world container will now send logs through the logspout container, and subsequently to our syslog console. If you need to ignore certain images by name/tag, that is possible usingthe LOGSPOUT and EXCLUDE_LABEL environment variables. volume=/var/run/docker.sock:/var/run/docker.sock \ $ sudo docker pull gliderlabs/logspout:latest Now we want to start the logspout container, which grabs the logs from all deployed containers and will send all events to our listening syslog server. This proves out our “syslog server” which is where logspout will be output all its messages. Then we run a quick sanity test from another console on the Docker host that sends a message to this TCP server (which happens to be 192.168.1.4 on my system) $ nc -w0 192.168.1.4 514 User Info msg from `hostname` on `date`"Īnd then you will see a message at the pseudo syslog server console: User Info msg from mydockerhost on Mon Apr 17 18:57: And to make it easy, instead of configuring the rsyslog service on our Ubuntu host, we will just use the standard utility netcat to listen on the syslog 514 tcp port and echo any data received.įirst we ensure the rsyslog service is disabled, and start our TCP listener on port 514: $ sudo service rsyslog stop Before moving on, you should be able to run the hello-world container.Īlthough logspout has third-party modules for sending log events to Kafka, Redis, Logstash, and Gelf, the easiest way to illustrate its functionality in this article is to send them to syslog.įor simplicity, we will send the logs to the syslog port of the parent Docker host.
If you do not have docker installed yet, see my article here. This is the architectural model of logspout, an open-source project that acts as a router for the stdout/stderr logs of other containers. Docker log collection can be done using various methods, one method that is particularly effective is having a dedicated container whose sole purpose is to automatically sense other deployed containers and aggregate their log events.