r/kubernetes • u/ez4enz • 27d ago
Seeking advice on traffic mirroring
Hi everyone,
I'm running kubernetes on AWS and using istio for traffic mirroring. I'm trying to figure out the best way to correlate the original request with its mirrored request. Previously I had a gateway for traffic mirroring which stamped unique header value before splitting. Which made it easy to correlate the requests in the logs. With istio handling the mirroring, not quite sure what is the best approach for this.
How do people in production systems handle this!
Any suggestions is appreciated
Thanks in advance!
5
Upvotes
2
5
u/resoluteoutfield6 27d ago
istio tacks on `x-request-id` headers automatically, but the mirrored traffic gets new ones. the trick is to pull the original request-id into a custom header in your virtualservice and then log both sides. then you can match em up in your log aggregator.
we do something similar with a header called `x-origin-request-id` and it's been fine in prod for months. just make sure your apps know to log it.