Logging entire POST body with HAProxy?
Solution 1:
Apparently since version 1.6.0 (October 2015) you can now. There is a new directive:
option http-buffer-request
That you include in the front-end or back-end to give HAProxy access to the body. And you use req.body to access it. Here is a summary of the config I used:
global
log 127.0.0.1 local0
debug
maxconn 2048
ulimit-n 8012
# ...
defaults
mode http
option httplog
log-format frontend:%f/%H/%fi:%fp\ GMT:%T\ body:%[capture.req.hdr(0)]\ request:%r
option dontlognull
# ...
frontend www-http
log global
option http-buffer-request
# id=0 to store body for logging
declare capture request len 40000
bind 7.7.7.7:8007
http-request capture req.body id 0
default_backend www-backend
backend www-backend
mode http
option forwardfor
# ...
Solution 2:
Haproxy does not have a facility to log POST content or HTTP bodies.
Use Wireshark instead.