I have basically two questions:
- Is it possible to only log the body (xml payload) of a POST request?
- What would be the impact on the HAProxy performance when the request body is logged?
For the first question, I know I can do this to capture the body of every request:
mode http
option http-buffer-request
declare capture request len 40000000
http-request capture req.body id 0
capture request header user-agent len 150
capture request header Host len 15
log-format '{"srcIP":"%[src]","backend":"%s","bIP":"%si","bPORT":"%sp","method":"%[capture.req.method]","user-agent":"%[capture.req.hdr(1),json(utf8s)]","uri":"%[capture.req.uri]","body":"%[capture.req.hdr(0)]"}'
Since the payload of the POST requests is XML, is it possible to parse it and extract only a few elements? With lua or golang?
For the second question, what would be the performance impact for HAProxy if the request body of every request is being logged to filesystem or syslog?
Will it slow down HAProxy? is there some kind of queueing mechanism that prevents performance impact?