Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Earlier i was not specifying a custom log format, and the captured request headers were getting printed fine. I wanted to log the unique-id-header, but could not find any way of doing so. So i copy pasted the log-format mentioned on http://haproxy.1wt.eu/download/1.5/doc/configuration.txt, and unique id started getting logged.

Unfortunately, now the captured request headers are not getting logged. The %hrl and %hsl are coming out as empty strings.

Very weird. Here is my config, plzz help :(

listen server
  bind *:80
  mode http

  option  httplog
  option  http-server-close
  no option logasap   # disable early logging of HTTP requests so that total transfer time is logged
  option  forwardfor
  capture request  header    X-Forwarded-For      len 500 
  capture request  header    Host                 len 500 
  capture request  header    X-Request-UID        len 500 
  rspadd  X-Haproxy-Backend:\ server

  # Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests
  log-format %Ci:%Cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %st\ %B\ %cc\ %cs\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r
  unique-id-format %{+X}o\ %Ci:%Cp_%Fi:%Fp_%Ts_%rt:%pid
  unique-id-header X-Haproxy-Unique-ID

Here is the log i see:

Sep 13 17:28:57 localhost haproxy[11979]: 
[id=0AA11BDA:A278_0AA15B71:0050_505217C5_0014:2ECB] [13/Sep/2012:17:28:37.567]
 server www-example-com-healthz/- 19998/0/2/1/+20001 200 +326
 - - ---- 10/10/1/1/0 0/0 {} {} 
"GET /testing/healthz?merchant=www.example.com&source=elb HTTP/1.1"

Note that %hrl and %hsl are empty strings :( How do i capture the request headers ??

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.