http-request set-var(txn.ratelimited) str(RATE-LIMITED) if too_many_requests
http-request capture var(txn.ratelimited) len 12
It works well for the frontend definition, but does not work with the backend definition. I would like to log some custom information in my backend configuration. Is there something compareable to http-request capture for the backend?
When using this action in a backend, double check that the relevant
frontend(s) have the required capture slots otherwise, this rule will be
ignored at run time. This can't be detected at configuration parsing time
due to HAProxy's ability to dynamically resolve backend name at runtime.
I guess that you need to set declare capture request len 12 on the related frontend.
Thank you so much. Can you share a link to the documentation? I have searched the documentation and did not find any hints like the above. I am an absolute newbie with haproxy.
Different to the hints above, the configuration reload fails with
Jan 22 00:12:19 elmratelimha11.fyre.ibm.com haproxy[22525]: [ALERT] (22525) : parsing [/etc/haproxy/haproxy.cfg:121] : error detected in backend ‘elm_default’ while parsing ‘http-request capture’ rule : proxy ‘elm_default’ has no frontend capability.
Jan 22 00:12:19 elmratelimha11.fyre.ibm.com haproxy[22525]: [ALERT] (22525) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
Jan 22 00:12:19 elmratelimha11.fyre.ibm.com systemd[1]: haproxy.service: Control process exited, code=exited, status=1/FAILURE