Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-13672

Incorrect regular expression in HAProxyLoggingSource

XMLWordPrintable

    • 3
    • False
    • Hide

      None

      Show
      None
    • False
    • ?
    • openstack-tripleo-heat-templates-14.3.1-17.1.20250211161409.e7c7ce3.el9osttrunk
    • None
    • Moderate

      To Reproduce Steps to reproduce the behavior:

      1. Install undercloud, or just install package openstack-tripleo-heat-templates
      2. Check content of `/usr/share/openstack-tripleo-heat-templates/deployment/haproxy/haproxy-container-puppet.yaml`. Specifically, the definition of `HAProxyLoggingSource`:
      [stack@director.keller171.lab ~]$ egrep -A5 "HAProxyLoggingSource:" /usr/share/openstack-tripleo-heat-templates/deployment/haproxy/haproxy-container-puppet.yaml
        HAProxyLoggingSource:
          type: json
          default:
            tag: openstack.haproxy
            file: /var/log/containers/haproxy/haproxy.log
            startmsg.regex: "^[a-zA-Z]{3} [0-9]{2} [:0-9]{8}"
      [stack@director.keller171.lab ~]$  
      1. This regular expression fails to match days 1 to 9, as it expects the day field to always have 2 digits.

      Expected behavior

      • The regular expression should match all days of the month.

      Bug impact

      • Not all HAproxy logs are matched. Only days 10 to 31

      Known workaround

      • Customers forwarding logs need to override the default definition with a custom one.

      Additional context

      • Here's the current regex matching the logs of February 3rd (none):
      [stack@director.keller171.lab ~]$ ansible -i inventory.yaml -m shell -a 'tail /var/log/containers/haproxy/haproxy.log | egrep "^[a-zA-Z]{3} [0-9]{2} [:0-9]{8}"' -b Controller[0]
      overcloud-controller-0 | FAILED | rc=1 >>
      non-zero return code
      [stack@director.keller171.lab ~]$  
      • Here's a proposed regex that accounts for the day field having 1 or 2 digits:
      [stack@director.keller171.lab ~]$ ansible -i inventory.yaml -m shell -a 'tail -5 /var/log/containers/haproxy/haproxy.log | egrep "^[a-zA-Z]{3} [ 123][0-9] [:0-9]{8}"' -b Controller[0]
      overcloud-controller-0 | CHANGED | rc=0 >>
      Feb  3 16:30:53 overcloud-controller-0 haproxy[7]: 192.168.24.24:50706 [03/Feb/2025:16:30:53.907] placement placement/overcloud-controller-2.ctlplane.keller171.lab 0/0/3/34/37 200 298 - - ---- 85/2/0/0/0 0/0 "GET /placement/resource_providers/64647aad-eb58-450c-8296-545a406b2f9e/allocations HTTP/1.1"
      Feb  3 16:31:47 overcloud-controller-0 haproxy[7]: 192.168.24.145:56220 [03/Feb/2025:16:31:47.675] keystone_public keystone_public/overcloud-controller-2.ctlplane.keller171.lab 0/0/0/121/121 200 7123 - - ---- 85/1/0/0/0 0/0 "GET /v3/auth/tokens HTTP/1.1"
      Feb  3 16:31:47 overcloud-controller-0 haproxy[7]: 192.168.24.14:53380 [03/Feb/2025:16:31:47.663] placement placement/overcloud-controller-0.ctlplane.keller171.lab 0/0/0/172/172 200 298 - - ---- 85/1/0/0/0 0/0 "GET /placement/resource_providers/135ec16d-3e71-4464-a325-2b7d75018e10/allocations HTTP/1.1"
      Feb  3 16:31:56 overcloud-controller-0 haproxy[7]: 192.168.24.16:55720 [03/Feb/2025:16:31:55.962] keystone_public keystone_public/overcloud-controller-1.ctlplane.keller171.lab 0/0/0/199/199 200 7123 - - ---- 87/2/0/0/0 0/0 "GET /v3/auth/tokens HTTP/1.1"
      Feb  3 16:31:56 overcloud-controller-0 haproxy[7]: 192.168.24.24:42600 [03/Feb/2025:16:31:55.911] placement placement/overcloud-controller-1.ctlplane.keller171.lab 0/0/17/278/295 200 298 - - ---- 87/2/0/0/0 0/0 "GET /placement/resource_providers/64647aad-eb58-450c-8296-545a406b2f9e/allocations HTTP/1.1"
      [stack@director.keller171.lab ~]$  

       

      • This issue is present in the latest versions of tripleo-heat-templates of 16.2 and 17.1

              rhn-support-lmiccini Luca Miccini
              rhn-support-enothen Eric Nothen
              rhos-dfg-pidone
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: