'HAProxy log presence of cookies in the response

I'm trying to better understand the applications behind my HAProxy, and I would love to include two things in the logs (in order of importance):

  • whether there were any cookies present in the response
  • what the name (and ideally length) of each cookie is

HAProxy logging configuration seems a bit inflexible for this sort of thing. So far I've figured out how to:

  • log the value of a specific cookie I've named
  • log the first x characters of the last "Set-Cookie" header in the response

The former doesn't help me at all. The latter seems better than nothing, but isn't quite what I want. What I really want is some sort of "has cookies" = true/false and then the list of cookies with lengths. Is this at all possible with HAProxy?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source