Last active
August 27, 2018 22:34
-
-
Save Tethik/b458036e734f5ec78bb362bba53e9d1c to your computer and use it in GitHub Desktop.
Sample microservice haproxy.cfg to be used with the filebeat haproxy module via syslog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
# send logs to syslog on port 9001. | |
log 127.0.0.1:9001 local0 info | |
chroot /var/lib/haproxy | |
user haproxy | |
group haproxy | |
daemon | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
option accept-invalid-http-request | |
timeout http-request 60s | |
timeout client 60s | |
timeout connect 60s | |
timeout server 90s | |
timeout check 5s | |
frontend incoming | |
log global | |
bind *:80 | |
# Define frontend, backends etc. | |
# compression algo gzip | |
compression type text/html text/plain text/css application/json image/png application/font-woff | |
maxconn 200000 | |
option http-server-close | |
option forwardfor | |
# Log request & response headers | |
capture request header Host len 64 | |
capture request header X-Request-Id len 64 | |
capture request header X-Forwarded-For len 64 | |
capture response header X-Request-Id len 64 | |
capture response header X-Cache len 64 | |
capture response header X-Varnish len 64 | |
capture response header Warning len 64 | |
# Microservice routing {name}.example.com | |
# In practice we use consul and consul-template to generate these automatically. | |
acl hello-microservice-com hdr(host) -i hello.example.com | |
use_backend hello_microservice if hello-microservice-com | |
backend hello_microservice | |
mode http | |
option http-server-close | |
balance roundrobin | |
server hello 127.0.0.1:1234 check | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment