Skip to content

request-capture sorting issue #732

@Denys-Janrain-L

Description

@Denys-Janrain-L

Hello,

I want to get specific headers into logs, to achieve this I've defined a configmap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: haproxy-kubernetes-ingress
  namespace: haproxy-controller
data:
  log-format: "%ci - %hrl [%t] \"%r\" %ST %B \"%[capture.req.hdr(0)]\" \"%[capture.req.hdr(1)]\" \"%[capture.req.hdr(2)]\" %TR %U \"%si:%sp\" %ST %Tw %Tc %Tr %Ts %sslv %[unique-id] \"%[capture.req.hdr(3)]\""
  request-capture: |
    hdr(Referer)
    hdr(Host)
    hdr(X-Custom1)
    hdr(User-Agent)
    hdr(X-Custom)

This results in a following configuration generated by haproxy-ingress:

  http-request capture hdr(Host) len 128 if { var(txn.path_match) -m dom 6b75b4bdfd8ffe79dd4959687330636f } 
  http-request capture hdr(Referer) len 128 if { var(txn.path_match) -m dom e3039f343dd732d17f5fc597812d25a2 } 
  http-request capture hdr(User-Agent) len 128 if { var(txn.path_match) -m dom 0eabbbb76a887b83ad564937d2c0ea38 } 
  http-request capture hdr(X-Custom) len 128 if { var(txn.path_match) -m dom 1ba911fbb93f6a913fd6a8ea5fa291b1 } 
  http-request capture hdr(X-Custom1) len 128 if { var(txn.path_match) -m dom 4bc428d1324db47bfec5e7035118a070 }

Order in config map and in configuration is inconsistent.
Problem is that I have to refer to elements by number in log-format, hence order is important here.
Or we need a way to access capture elements by name, regardless of the order in a config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions