spoa-mirror
spoa-mirror copied to clipboard
how to mirror only specific traffic, based on ACLs
We have a complex HAproxy config with lots of frontends and backends. The config is auto-generated, based on a template which renders in a loop all existing www,ws,... services for 1-n customers, using docker-gen.
We now want to mirror certain traffic, e.g. only for customer1 and customer2, but not for customer 3. The original traffic is routed to 1-n backends on 1-n docker containers.
I tried this in mirror.cfg: [mirror] spoe-agent mirror log global messages mirror acl customer1-mirror_rule hdr(host) -i ws.customer1.com use-backend mirroragents if customer1-mirror_rule
but this syntax is not valid: "parsing [/etc/haproxy/mirror.conf:5] : unknown keyword 'acl' in spoe-agent section"
Is there a way to limit mirroring to specific streams and what is the syntax?
Second question: As I have to specify the target URL when starting the spoe-agent, mirrored traffic for customer1 & 2 go to that single target. Can I run a second agent and route mirror traffic of customer2 to a different URI ?
@c031917 have you checked https://www.haproxy.com/blog/haproxy-traffic-mirroring-for-real-world-testing/#tuning-the-mirrored-traffic?
This part:
spoe-message mirror-msg
args arg_method=method arg_path=url arg_ver=req.ver arg_hdrs=req.hdrs_bin arg_body=req.body
acl is_search path_beg /search
event on-frontend-http-request if is_search