Last active
September 1, 2023 23:39
-
-
Save lazywithclass/d255bb4d2086b07be178 to your computer and use it in GitHub Desktop.
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 | |
log 127.0.0.1 local0 | |
user root | |
group root | |
daemon | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
retries 3 | |
option redispatch | |
timeout connect 5000 | |
timeout client 120000 | |
timeout server 90000 | |
frontend www-http | |
bind 0.0.0.0:9000 | |
option http-buffer-request | |
declare capture request len 400000 | |
http-request capture req.body id 0 | |
log-format {"%[capture.req.hdr(0)]"} | |
default_backend node-servers | |
backend node-servers | |
server node google.com:80 maxconn 20 |
@ValeryDubrava Thanks for the reply
i have tryied your config but i still get empty body "-"
i wounder what haproxy version are you using? i'm using v2.0.29
i think by now i have tried all combinations..nothing works
## ------ LOG ---------- #no log ####this is real line USE THIS to disable log!!! when commented allows log 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)]"}' ## --------------------
DONT USE IT IN PRODUCTION! it will kill performance dependent on log method more or less :P Its also not safe and breaks bunch of laws. Remember!
this works for me on haproxy 2.4, thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lynomet I've success with it, try this:
If I understand correctly index of capture.req.hdr refers to each line http-request capture ...