HAProxy community

We have a question regarding L7 retries and redispatch feature of HAProxy, as described in this post, published last year - https://www.haproxy.com/blog/haproxy-layer-7-retries-and-chaos-engineering/

We are using HAProxy v2.0.14 and have enabled the retries feature for a few backends and found it to be working absolutely fine.
For a detailed analysis of traffic errors, each server’s web logs are processed to find out the number & type of 5xx errors encountered. But, these numbers get inflated because of retries, as any 5xx failure will be re-attempted as per the set configuration.
Is it possible to pass the retry attempt number as an “add-header” value for it to be written in the server logs? This will help in analysing not only the cumulative total 5xx errors but, also the number of unique requests that failed. Maybe some other approach can also be adopted. Kindly suggest, thanks