Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to mirror only specific traffic, based on ACLs #29

Open
c031917 opened this issue Mar 16, 2022 · 1 comment
Open

how to mirror only specific traffic, based on ACLs #29

c031917 opened this issue Mar 16, 2022 · 1 comment

Comments

@c031917
Copy link

c031917 commented Mar 16, 2022

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 ?

@scofield-ua
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants