HAProxy community

Return haproxy http log


When I upgrade haproxy from 1.7.9 to 1.8.2, I just got haproxy http log like the following lines occasionally:

<134>Jan 11 14:29:28 haproxy[4022]: [11/Jan/2018:14:29:28.392] 1 manager_manager_4093de3495fba448ea41e80925f0fa07a88748d00b91c2326b6181365092b70a_8080 200 898 {www.example.com} acsrouting “GET /getcinfo?cid=1970182 HTTP/1.1”
<134>Jan 11 14:31:02 haproxy[4034]: [11/Jan/2018:14:31:02.505] 1 freegift_freegift_2fb261e81daf84384215488992cd6251d8f5fa65f792b3398cd30d76e8e02c78_8080 200 605 {www.example.com} acsrouting “GET /freegift/freegift/getfreegiftpopularity?cid=826907 HTTP/1.1”

Normally, it should return my backend server’s response messge, but sometimes return these logs.
And it’s a bug for haproxy1.8.2? It is very puzzling!


And I have enabled rsyslog, and config “log local0” in the global section…


What’s wrong with that? Are you saying this request does not reach the backend?

Please enable option httplog and share your configuration.


I have enabled “option httplog” in the default section, and my haproxy config example is like this:

maxconn 1048576
stats socket /var/run/haproxy-admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
pidfile /var/run/haproxy.pid
log local0
max-spread-checks 60s
#hard-stop-after 60s
master-worker no-exit-on-failure
#nbproc 1
#stats bind-process 1
#cpu-map 1 0
nbthread 2

resolvers mydns
nameserver dns1
resolve_retries 3
timeout retry 1s
hold other 10s
hold refused 10s
hold nx 10s
hold timeout 10s
hold valid 10s

mode http
maxconn 1048576
balance roundrobin
timeout connect 5000ms
timeout client 65000ms
timeout server 65000ms
#timeout http-request 65000ms
timeout tunnel 3600s
timeout check 5s

option httplog
option dontlognull
option http-server-close
option abortonclose
option log-health-checks
log global
log-format %ci:%cp\ [%t]\ %Tr\ %s\ %ST\ %B\ %hr\ %hs\ %H\ %{+Q}r

# If sending a request to one server fails, try to send it to another, 3 times
# before aborting the request
retries 3
#http-reuse safe
option forwardfor
# Do not enforce session affinity (i.e., an HTTP session can be served by
# any Mongrel, not just the one that started the session
option redispatch
no option checkcache
option accept-invalid-http-response
option accept-invalid-http-request
default-server init-addr last,libc,none

listen stats
bind *:1936
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy?stats
stats auth admin:admin

frontend name_resolver_http
bind *:80
errorfile 503 /usr/local/etc/haproxy/errors/503.http
capture request header Host len 80

monitor-uri /haproxy-monitor
acl is_websocket hdr(Upgrade) -i WebSocket

frontend name_resolver_https
bind *:443 ssl crt /usr/local/etc/certs/ alpn h2,http/1.1
reqadd X-Forwarded-Proto:\ https
errorfile 503 /usr/local/etc/haproxy/errors/503.http
capture request header Host len 80

monitor-uri /haproxy-monitor
acl is_websocket hdr(Upgrade) -i WebSocket

And my scenario is:
application client -> haproxy -> application server;

but the haproxy instance response its log (not the application server response message) to the application client occasionally.


At the very least I need you to maintain the real frontend/backend names. The log refers to acsrouting, but that is not something that is in the configuration you provided.

Please maintain at least frontend/backend names.


Thanks a lot…
I have updated my haproxy from 1.8.2 to 1.8.3, and then test my case again, and it never goes wrong.