# Request Logging - Session Cookie only

**URL:** <https://community.f5.com/t/request-logging-session-cookie-only/52921>\
**Category:** Technical Forums\
**Created:** [November 8, 2019, 6:43pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921 "2019-11-08T18:43:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Nascimen](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Andrew\_Nascimen](https://community.f5.com/u/Andrew_Nascimen)\
**Post date:** [November 8, 2019, 6:43pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921/1 "2019-11-08T18:43:57Z")

</div>

Hit a bit of a snag here. I’m using request logging profiles to log any and all web traffic.

We have a case where we need to log the $Cookie header. Easy enough to just say “$Cookie” in the template field. The problem is, it logs every single cookie field. I only need the session cookie. Is there a way to do this with request logging templates?

---

<div class="post-metadata">

**Author:** ![Andrew-F5](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@Andrew-F5](https://community.f5.com/u/Andrew-F5)\
**Post date:** [November 11, 2019, 5:02pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921/2 "2019-11-11T17:02:54Z")

</div>

Andrew,

Years ago there was a feature request for logging a specific cookie via a request log profile tracked as ID455091 but I can’t find any information that implies it was adopted into a future release.

Can you try the following syntax in your template?

${Cookie[first]}

• Where ‘first’ is the name of your cookie.

Best,

Andrew

---

<div class="post-metadata">

**Author:** ![Andrew\_Nascimen](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Andrew\_Nascimen](https://community.f5.com/u/Andrew_Nascimen)\
**Post date:** [November 11, 2019, 7:04pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921/3 "2019-11-11T19:04:49Z")

</div>

Andrew,

That did it! Thanks, appreciate the support here. Was losing my mind over this.

That one should probably get documented. Couldn’t find any information regarding how to break up a header.

Thanks again.

Best,

Andrew

---

<div class="post-metadata">

**Author:** ![Andrew-F5](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@Andrew-F5](https://community.f5.com/u/Andrew-F5)\
**Post date:** [November 11, 2019, 7:10pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921/4 "2019-11-11T19:10:53Z")

</div>

Andrew,

I’ll work internally here at F5 to get some K article in the works detailing the feature.

Best,

Andrew

---

<div class="post-metadata">

**Author:** ![jba3126](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jba3126](https://community.f5.com/u/jba3126)\
**Post date:** [February 15, 2023, 3:29pm UTC](https://community.f5.com/t/request-logging-session-cookie-only/52921/5 "2023-02-15T15:29:24Z")

</div>

@Andrew-F5 &nbsp;not sure if you put the K article together, but what I’ve found is you can extract what you observe in the header.&nbsp; For example, if I use a Cookie=$[Set-Cookie} it logs all cookies with the Set-Cookie value in the response including the attributes which is super helpful.  
Example:  
[Cookie=ASP.NET](http://Cookie=ASP.NET)\_SessionId=oeevlmocqptxwilyqx1b52ig; path=/; HttpOnly; SameSite=Lax, [ASP.NET](http://ASP.NET)\_SessionId=oeevlmocqptxwilyqx1b52ig; path=/; HttpOnly; SameSite=Lax, \_op\_aixPageId=1278498b-aa71-48f5-b684-247fd2bf4d03-6812-3828; path=/; HttpOnly, DEV-Cookie=1295065098.64288.0000; path=/; Httponly; Secure.  
In addition, there was a Trace ID that is injected in which I did a Trace\_ID=${X-OPNET-Transaction-Trace}, yielded:  
Trace\_ID=1278498b-aa71-48f5-b684-247fd2bf4d03-6812-3828

My only challenge is formatting at this point to make it easy for our Splunk engineers.
