Skip to content

Instantly share code, notes, and snippets.

@angryziber
Last active February 8, 2019 19:05
Show Gist options
  • Save angryziber/e3511130d1ef0e9e7d2d6b9f9172f3b9 to your computer and use it in GitHub Desktop.
Save angryziber/e3511130d1ef0e9e7d2d6b9f9172f3b9 to your computer and use it in GitHub Desktop.
HAProxy in Docker with logging to stdout (because it's hard to figure out)
# The trick here is to run syslogd, writing output to the stdout of PID1, which Docker daemon captures
# This may be a useful trick with other executables as well that can only write to syslog
version: '3'
services:
haproxy:
image: haproxy:1.9-alpine
entrypoint: ''
command: sh -c 'syslogd -O /proc/1/fd/1; /docker-entrypoint.sh haproxy -f /etc/haproxy/haproxy.cfg'
ports:
- 80:80
volumes:
- .:/etc/haproxy:ro
# Include this in your haproxy config file
# It will log to /dev/log that syslogd provides
defaults
log /dev/log local0
mode http
option httplog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment