3

In Haproxy 1.8.8, I am trying to log the final URI (not the incoming URI that was received in the frontend), In the backend section, i have proxy rewrite rule to change the path. I want that new path to be in the haproxy log. Here is the sample haproxy config file, i want to log /defgh/v1/newpath somewhere in the log. By default, http log-format captures only the request URI which in this below sample it wille /abc/oldpath. Can anyone please suggest how to capture the final path after rewrite rule is processed

sample haproxy config

frontend http-in
    option httplog
    bind *:80
    acl url_oldpath path_beg /abc/oldpath
    use_backend servers if url_oldpath

backend servers
    reqirep ^([^\ ]*)\ /abc/oldpath(.*) \1\ /defgh/v1/newpath\2
    server server1 myServerIP:80 
DevOpsNewB
  • 185
  • 2
  • 14

1 Answers1

1

You cannot log the response path in HAProxy:

http mode only | %HP  | HTTP request URI without query string (path)  | string  

Only the request path is available to be logged. See the fields available to be logged in the HAProxy documentation.

Is your backend server able to log the requests as it receives them? You could see the final path impacted by the rewrite there.

jmoney
  • 443
  • 2
  • 10