From d80f4a93ab355ade684578be6c0b1c39f604ff34 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 17 Jul 2019 13:06:11 -0700 Subject: [PATCH] Collect haproxy logs via syslog Haproxy wants to log to syslog (and not stdout for performance reasons, see https://github.com/dockerfile/haproxy/issues/3). However there is no running syslog in our haproxy container. What we can do is mount in the host's /dev/log and have haproxy write to the hosts syslog to get logging. Do this via a docker compose volume bind mount. Change-Id: Icf4a91c2bc5f5dbb0bfb9d36e7ec0210c6dc4e90 --- playbooks/roles/haproxy/files/docker/docker-compose.yaml | 1 + playbooks/roles/haproxy/templates/haproxy.cfg.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/haproxy/files/docker/docker-compose.yaml b/playbooks/roles/haproxy/files/docker/docker-compose.yaml index efa7166132..dffb142b49 100644 --- a/playbooks/roles/haproxy/files/docker/docker-compose.yaml +++ b/playbooks/roles/haproxy/files/docker/docker-compose.yaml @@ -8,6 +8,7 @@ services: image: haproxy:latest network_mode: host volumes: + - /dev/log:/dev/log - /var/haproxy/etc:/usr/local/etc/haproxy - /var/haproxy/run:/var/haproxy/run haproxy-statsd: diff --git a/playbooks/roles/haproxy/templates/haproxy.cfg.j2 b/playbooks/roles/haproxy/templates/haproxy.cfg.j2 index 5d96f92804..5d35502b63 100644 --- a/playbooks/roles/haproxy/templates/haproxy.cfg.j2 +++ b/playbooks/roles/haproxy/templates/haproxy.cfg.j2 @@ -1,7 +1,7 @@ global uid 1000 gid 1000 - log 127.0.0.1 local0 + log /dev/log local0 maxconn 4000 pidfile /var/haproxy/run/haproxy.pid stats socket /var/haproxy/run/stats uid 1000 gid 1000 mode 0600 level admin