Numeric variables default to -

Hi,

I’m trying to log as json, starting from GitHub - salimchehab/terraform-aws-haproxy-cloudwatch-log-format-json: Setup CloudWatch Log Groups and Metric Filters for HAProxy logs (adjusted to JSON output format). with friendlier variable names.
These sequences:
“backend”:{“name”:"%b",“beconn”:%bc,“source_ip”:"%bi",“source_port”:%bp,“queue”:%bq}
“server”:{“name”:"%s",“srv_conn”:%sc,“ip”:"%si",“port”:%sp,“queue”:%sq}
for example, will produce something like this:
“backend”:{“name”:“emea-dfv4”,“beconn”:0,“source_ip”:"-",“source_port”:-,“queue”:0},
“server”:{“name”:"",“srv_conn”:0,“ip”:"-",“port”:-,“queue”:0}
if a DENY rule is matched (termination state PR–). This is not valid json, specifically these two:
“source_port”:-
“port”:-
Now %bp and %sp are supposed to be numeric, so they should default to a number, like -1, or the - should be quoted.
Not sure if that’s something achievable with a smart log-format pattern, or a little improvement is needed in the source code.

Thanks,
Victor

Timing values default to -1, would be good if port numbers had the same convention.