How do I record traffic?

I want to record traffic to one of my backends. I found https://github.com/linkedin/flashback which is a proxy which records traffic but I found no way of configuring it between HAProxy and the backend. Is there a way to configure a proxy between HAProxy and a backend? If not is there another way to record traffic?

Sure, just point to the intermediate proxy instead of the backend and configure the intermediate proxy accordingly.

Why not tcpdump it?

But then how will the intermediate proxy know where to forward the request to?

By configuring the intermediate proxy accordingly.

I don’t understand. If the intermediate proxy is defined as a backend then there’s no information about the final destination in the request.

Yes, that’s what you configure on the first proxy layer. On the second proxy layer, your intermediate proxy, you actually have to configure it with destination IPs/hostnames of the actual backend servers, which was previously in the backend section of the first proxy layer.

The setup is client -> haproxy -> flashback (recording proxy) -> backend. Is that what you meant?

With a full featured proxy like HAProxy or Squid I could instruct all requests to be forwarded to a specific server but Flashback’s functionality doesn’t include that, it’s for recording and replaying traffic, so it’s a very simple passthrough proxy. So that won’t work. I assume there could be some way to rewrite the request with the final destination information but I don’t know what it is.

I don’t know what flashback is or does. Why don’t you ask flashback folks?