Documentation is here
log-format '{"host":"%H","ident":"haproxy","pid":%pid,"time":"%Tl","internal":{"conn":{"act":%ac,"fe":%fc,"be":%bc,"srv":%sc},"queue":{"backend":%bq,"srv":%sq},"time":{"tq":%Tq,"tw":%Tw,"tc":%Tc,"tr":%Tr,"tt":%Tt},"termination_state":"%tsc","retries":%rc,"network":{"client_ip":"%ci","client_port":%cp,"frontend_ip":"%fi","frontend_port":%fp},"ssl":{"version":"%sslv","ciphers":"%sslc"},"request":{"method":"%HM","hu":"%HU","hp":"%HP","hq":"%HQ","protocol":"%HV","header":{"host":"%[capture.req.hdr(0),json(utf8s)]","xforwardfor":"%[capture.req.hdr(1),json(utf8s)]","referer":"%[capture.req.hdr(2),json(utf8s)]","user_agent":"%[capture.req.hdr(3),json(utf8s)]"}},"name":{"backend":"%b","frontend":"%ft","server":"%s"},"response":{"status_code":%ST,"header":{"xrequestid":"%[capture.res.hdr(0),json(utf8s)]"}},"bytes":{"uploaded":%U,"read":%B}}}'
keep in mind that [caputre.*.hdr(i)]
variables working only if you explicitly set capture instructions in your service section, like this:
frontend whatever
capture request header Host len 40
capture request header X-Forwarded-For len 50
capture request header Referer len 200
capture request header User-Agent len 200
capture response header X-Request-ID len 50
and it seems that the order of captures matter