Parsing [/etc/haproxy/haproxy.cfg:88]: failed to parse log-format : failed to parse sample expression <CC,json(ascii)> : unknown fetch method 'CC'.
Per documentation a converter is a function that always follows a fetch.
Based on this I don’t see a way how to do it but I would like to ask:
Can be json converter used for any log flag ? or it isn’t necessary ?
the %CS var seems to return the value of the captured cookie. As it have to be defined, you will only capture the same cookie. Is it what you are trying to do ? If so, you can try to log it the var capture.res.hdr(<idx>)
you’re combining two different types of log format interpolation. %CS is a log variable, but %[CS,json(utf8p)] is trying to use a “CS” fetch and then convert it using json. But the CS fetch doesnt exist.
Unfortunately, I don’t see a fetch that is equivalent to %CS. You do have some options, though. You could use %{+E}CS which will escape some characters, notable ", although it isn’t exactly what you need for json. Or if you just need a specific cookie you could do something like %[res.cook(mycookie),json(utf8p)].