Hi all.
I am trying to log the request body with haproxy like this:
capture request header User-Agent len 400
capture request header Host len 150
http-request capture req.body len 10000
capture request header authorization len 80
capture request header X-Client-Auth len 80
log-format "%trg client_address=%ci, client_port=%cp, server_address=%si, server_port=%sp, path=%r, response_status=%ST, total_time=%Tt, bytes=%U, user_agent=%{+Q}[capture.req.hdr(0)], requested_host=%{+Q}[capture.req.hdr(1)], body=%{+Q}[capture.req.hdr(2),regsub(\n,\\n,g)]"
Sadly the result is empty in most of the cases.
I have noticed that there is a length limit so I tried to increase that as well (not sure if I have done it right, though):
log /dev/log len 10000 local0
Still the body is empty in the log file:
Feb 8 15:02:02 … haproxy[27865]: 08/Feb/2021:15:02:02 +0000 client_address=…, client_port=50500, server_address=…, server_port=8001, path=…, response_status=200, total_time=247, bytes=2118, user_agent=“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36”, requested_host=“…”, body=“”
Am I missing something?
Greetings
Lioh