HAProxy community

How to capture Cookies in haproxy http logs


Hello all,

I am trying to configure http logs for haproxy. I am able to capture the all the required details except cookies. I am very new to haproxy and not have much knowledge. in haproxy official document I found below command to use in front end,

capture cookie “name” len 32

I am confused what to give at “name” field ? is any predefined names exist like for capturing headers or do I need to explicitly define the name of the cookie in ACL and then use here ?

your help means alot for me :slight_smile:

Sandeep Uppala


You need to explicitly specify the name of the cookie that you want to log. This is because you are accessing a specific cookie, as per:


If you want to log the entire cookie header, capture the header instead.


thank you so much for for the quick reply, I am able to capture cookie header now. Well I am actually trying to log session id of each request. can you please help me if any specific way that can help to track this ?

Sandeep Uppala


Capture the exact cookie that contains the session ID, as simple as that.


Thank you and sorry for the late reply.

Here is the issue , we have multiple cookies for each project and in which project-name.sid is carrying session ids.

if I want to capture only .sid cookies, how can I achieve them ?
have tried below, But it didn’t worked.
capture cookie *.sid len 32

each log contains only one "project-name.sid ".

Thanks in advance,

Sandeep Uppala


Help please :no_mouth:


It’s not possible to do so.

If you want this, you have to change your application from project-name.sid to sid.project-name, then you can just use capture cookie sid. len 32 as per capture cookie docs.