Description
What problem are you trying to solve?
I have an issue with Access Log regarding those fields:
- request_bytes - Its zero if Content-Length header is not set on the request.
- response_bytes - Its zero if Content-Length header is not set on the response.
- client_addr = It doesn't provide a way to use
X-Forwarded-For
header - when a Load Balancer involve, it would be the same address for all requests.
How should the problem be solved?
The fix should enhance the http-access-log which implemented in this file:
https://github.com/linkerd/linkerd2-proxy/blob/main/linkerd/http-access-log/src/lib.rs#L121
- For request_bytes - if
Content-Length
header is missing, fallback to actual input stream length (or at least, amount of bytes read from the stream). - For response_bytes - if
Content-Length
header is missing, fallback to actual output stream length. - client_addr - Provide a way to specify which client_addr to take.
Any alternatives you've considered?
As an alternative, instead of changing current fields, new fields can be added:
- input_bytes - actual input stream length
- output_bytes - actual output stream length
- x_forward_for - the value of
x_forward_for
header.
How would users interact with this feature?
With this feature, system admins and devops can easily track the payload sizes of both request and response, without asking devs to set the Content-Length
header which is not set by default.
System admins and devops can also know where requests came from by checking the client_addr and get the actual IP instead of the load balancer IP.
Would you like to work on this feature?
maybe