Haproxy log formats are escaped by jinja

Bug #2051710 reported by Dominik Duranc
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
octavia
New
Undecided
Unassigned

Bug Description

Haproxy template is configured to autoescape special characters like double quotes in custom haproxy log formats, which makes it impossible to use json formatted logs.

Example custom log format:
```
[haproxy_amphora]
user_log_format = '{"project_id":"{{ project_id }}","loadbalancer_id":"{{ lb_id }}","path":"%HP"}'
```

Gets transformed into:
```
[root@amphora-793dc5b2-b718-45ee-940c-61edd82a07e9 ~]# grep log-format /var/lib/octavia/*/haproxy.cfg
    log-format {"project_id":"4c920982974243aeaefc23415c852cec","loadbalancer_id":"08388ef2-734b-4b6d-a8bc-c03975bd7c29""path":"%HP"}
```

This bug can be fixed by adding 'safe' filter to jinja variable:
https://opendev.org/openstack/octavia/src/branch/master/octavia/common/jinja/haproxy/combined_listeners/templates/macros.j2#L194

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.