HAProxy community

Capture request and response fields name in haproxy logs

I’m updating HAProxy config to capture request and response fields name in haproxy logs.

        # log the name of the virtual server
        capture request  header Host len 20
        # log the amount of data uploaded during a POST
        capture request  header Content-Length len 10
        # log the beginning of the referrer
        capture request  header Referer len 20

capture request header X-Forwarded-For len 50

        # server name (useful for outgoing proxies only)
        capture response header Server len 20

        # logging the content-length is useful with "option logasap"
        capture response header Content-Length len 10

        # log the expected cache behaviour on the response
        capture response header Cache-Control len 8

        # the Via header will report the next proxy's name
        capture response header Via len 20

        # log the URL location during a redirection
        capture response header Location len 20

        capture request header X-Forwarded-For len 50

capture request header Referer len 15

After enabling these showhow logs not showing header fields name. How to enable fields name too in logs.

Provide the entire configuration please.

You need to access those options in a custom log format. Did you do that?