I am capturing the user-agent
using:
http-request capture req.hdr(User-Agent) len 192
And then trying to create a custom JSON
log format like this:
log-format '{"User-Agent":%{+Q,+E}[capture.req.hdr(0)]}'
It works but when a User Agent includes square brackets, for example:
Dalvik/1.6.0 (Linux; U; Android 4.4.4; Ixion X LTE 4.5 [Build KTU84P])
The option +E
escapes the square bracket and brakes the JSON, it creates something like:
"User-Agent": "Dalvik/1.6.0 (Linux; U; Android 4.4.4; Ixion X LTE 4.5 \[Build KTU84P])"
When the UA contains extra quotes there is no problem:
"User-Agent": "this \"works\" fine"
Therefore wondering if there is a way to specify escaping only double quotes or alternatives to make the log format JSON
compatible