Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Last active September 1, 2023 23:39
Show Gist options
  • Save lazywithclass/d255bb4d2086b07be178 to your computer and use it in GitHub Desktop.
Save lazywithclass/d255bb4d2086b07be178 to your computer and use it in GitHub Desktop.
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
@agengdp
Copy link

agengdp commented Sep 1, 2023

        ## ------ 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