Log cookie name from server

I am trying to verify if the loadbalancer are taking wrong lb decisions. I am aware of the “one connect” and “lb detach” functions but at the moment I don’t use it. I want to try to log the http_response from the server to verify if the server is sending the correct cookie to the client. How should I be able to do it ?

I have tried to add following but I can’t see anything in the response. Do you have any idea ? when HTTP_RESPONSE { set cookieresponse [HTTP::cookie names] HSL::send $hsl “<190>[clock format [clock seconds] -format “%b %d %R:%S”] lb-test test-request-response-cookie: COOKIE=$cookieresponse” }

BR Max

Hi! Have you opened a connection to a syslog server?

Ie:

when CLIENT_ACCEPTED {
        set hsl [HSL::open -proto UDP -pool syslog_server_pool]
}

when HTTP_RESPONSE { 
    set cookieresponse [HTTP::cookie names]
    HSL::send $hsl "<190>[clock format [clock seconds] -format "%b %d %R:%S"] lb-test test-request-response-cookie: COOKIE=$cookieresponse"
}

If you have, have you tried checking with TCP-dump if the BigIP sends the data to the syslog server with ie tcpdump? Some syslog servers will not log the message unless it matches a certain pattern.

/Patrik

The syslog is working fine. I can see the cookie in the HTTP_REQUEST but should’t I be able to debug the request from ther server also (HTTP_RESPONSE) ?

BR Max

Never tried. Have you considered using the header command instead and log the set-cookie headers?

/Patrik

I think this will work to log the set-cookie from the server .

when HTTP_RESPONSE { if {[HTTP::header exists “Set-Cookie”]} { foreach cookievalue [HTTP::header values “Set-Cookie”] { HSL::send $hsl “<190>[clock format [clock seconds] -format “%b %d %R:%S”] lb-test testrequst-RESP: COOKIESERVER=$cookievalue CS=[IP::client_addr]:[TCP::client_port] → [IP::server_addr]:[TCP::server_port]” } } }

Looks about right to me. I did something similar the other day, but for cache headers so it should definitely work. :slight_smile:

/Patrik