Forum Discussion

Bill_Chipman_10's avatar
Bill_Chipman_10
Icon for Nimbostratus rankNimbostratus
Feb 18, 2015

Add a cookie value to request log template?

Is there a way to include the value of a cookie in the request log profile? I'm looking to replace the ${_COOKIE} variable in my request logs.

 

3 Replies

  • Hi Bill,

    I cannot help right now with the request log profile.

    But perhaps an iRule will do the job as well for you?

    The following one would just log each cookie including value found in the request:
    when HTTP_REQUEST {
        if { [HTTP::header exists "Cookie"] } {
            foreach cookiename [HTTP::cookie names] {
                log local0. "cookie <$cookiename> value: [HTTP::cookie value $cookiename]"
            }
        }
    }
    

    Thanks, Stephan

  • The solution was hidden in the documentation. You just have to include a variable $Cookies in the access log template. This displays ALL cookies in the log. Met my requirements.