Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Unable to add request headers to logs

$
0
0

Using HAProxy version: 2.8.7

I am trying to add request headers to log entries for testing purposes. However, I am apparently doing something incorrectly.

Here are what I consider to be the relevant parts of the config file:

global
  log stdout len 65535 format raw local0

defaults
  mode   http
  option httplog

frontend http-ingress
  log global

  http-request set-var(txn.host) req.hdr(Host)
  http-request set-var(txn.agent) req.hdr(User-Agent)
  log-format "host: %[var(txn.host)], agent: %[var(txn.agent)]"

The log output is:

host: !,(BADINDEX) agent: !(BADINDEX)

If I use req.hdrs instead:

  log-format "http_request_headers: %{+Q}[var(txn.req_hdrs)]"
  http-request set-var(txn.req_hdrs) req.hdrs

The log output is:

http_request_headers: !{(MISSING)+Q}[var(txn.req_hdrs)]

What am I doing wrong?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>