il-fox
il-fox

Reputation: 75

Haproxy - cannot capture URL

Recently I started using haproxy as a load-balancer and would like to capture both the URL and the post body. I am successful in capturing the post data but cannot find a solution to capture also the URL.

haproxy.cfg:

frontend main
  log global
  option http-buffer-request
  declare capture request len 400000
  http-request capture req.body id 0
  log-format {"%[capture.req.hdr(0)]"}
  mode http
  bind *:5000

Input:

wget http://test.com:5000/ --post-data="THIS_IS_A_TEST"

Output:

[root@testhaproxy01 ~]# tail /var/log/haproxy/haproxy.log
Apr 25 11:16:17 test.com haproxy[17061]: {THIS_IS_A_TEST}
Apr 25 11:16:17 test.com haproxy[17061]: {THIS_IS_A_TEST}

How can I also capture the http://test.com:5000/?

I'm using haproxy version 1.8.7.

Upvotes: 0

Views: 1620

Answers (1)

nuster cache server
nuster cache server

Reputation: 1791

You can use this

 capture request  header Host len 20
 log-format  "%[capture.req.hdr(1)]%HU ==> {%[capture.req.hdr(0)]}"

Upvotes: 1

Related Questions