Hello Willy,
Following your suggestions, I've been testing the "debug" solution (in a
2.2 HAproxy) with this sample conf:
http-request use-service prometheus-exporter if { path,debug(buf0) -m
beg /metrics }
seeing from the socket the entries registered on buf0:
# echo "show events buf0" | socat stdio /var/run/haproxy.sock
<0>2020-07-24T09:24:19.598250+02:00 [debug] buf0: type=str </metrics>
<0>2020-07-24T09:24:26.981110+02:00 [debug] buf0: type=str </metrics>
<0>2020-07-24T09:24:34.598446+02:00 [debug] buf0: type=str </metrics>
Later on, the same http condition, but now with "set-var":
http-request use-service prometheus-exporter if {
path,set-var(txn.last_expr) -m beg /metrics }
log-format %ci,%[var(txn.last_expr)]
and seeing the lines on the logs:
Jul 24 09:33:49 server1 haproxy[10291]: 192.168.1.17,/metrics
Jul 24 09:34:04 server1 haproxy[10291]: 192.168.1.17,/metrics
I think that the "set-var" way is more flexible, as you can combine it
with any other variable that helps to identify the client request. The
proposed "here" converter can helps more.
As an idea, it would be nice if these debug modifications done over the
ACLs can be logged based on a condition, for example only with a
particular client pattern, something like:
acl client_debug hdr_sub(User-Agent) client1-user-agent
log-format %ci,%[var(txn.last_expr)] if client_debug
Thanks for your detailed explanations,