Howdy;
I’m using a custom json-formatted log_format in HaProxy 2.8 LTS, and wanted to record a few headers from requests to frontends (http, https).
I noticed we were doing it two ways (different devs over different time periods):
capture request header User-Agent len 256
http-request capture req.hdr(User-Agent) len 256
Both syntaxes seem to work in the log_format (this is an excerpt):
..."user-agent":"%[capture.req.hdr(0),json(utf8ps)]"...
Reading the docs, I think capture request header
is more appropriate.
- capture request header: HAProxy version 2.8.14 - Configuration Manual
- http-request capture req.hdr HAProxy version 2.8.14 - Configuration Manual
Anyone have wise council or examples of when you’d pick one over the other?