├── Dockerfile └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | RUN apt-get update -q 3 | RUN apt-get install -y rsyslog 4 | CMD rsyslogd -n 5 | VOLUME /dev 6 | VOLUME /var/log 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # One syslog to rule them all 2 | 3 | 1. Build the syslog container: 4 | 5 | `docker build -t syslog .` 6 | 7 | 2. Monitor the logs: 8 | 9 | `docker run --volumes-from syslog ubuntu tail -f /var/log/syslog` 10 | 11 | 3. Run it: 12 | 13 | `docker run --name syslog -d -v /tmp/syslogdev:/dev syslog` 14 | 15 | 4. Start another container to send logs: 16 | 17 | `docker run -v /tmp/syslogdev/log:/dev/log ubuntu logger hello` 18 | 19 | 20 | 5. *Alternative to #2*, as of docker v1.3 use the `docker-exec` command to inspect syslog container directly, after some logs have been generated 21 | 22 | `docker exec -t syslog tail -f /var/log/syslog` 23 | 24 | 6. See in the log message show up in the "tail" container. 25 | 26 | 27 | ## Background 28 | 29 | For more information on this approach, see [Multiple Docker containers logging to a single syslog](http://jpetazzo.github.io/2014/08/24/syslog-docker/). 30 | 31 | 32 | ## Other methods 33 | 34 | See [#4](https://github.com/jpetazzo/syslogdocker/issues/4#issue-95955147) for insights about 35 | achieving similar results without requiring an host bind moount (thanks @helderco!) 36 | --------------------------------------------------------------------------------