Forum Discussion

Shay_Ben-David1's avatar
Shay_Ben-David1
Icon for Nimbostratus rankNimbostratus
Jan 05, 2009

cookie logging

i have a situation of cookie persistence that does not keep the persistence, problem is that there is multiple A record to the hosts, i log behavior of it and it looks to move to other server in the pool after host is changing, is there a way to persist based on cookie with different hosts.

 

Thanks

 

1 Reply

  • Hi Shay,

    You can use a rule to log various details on requests/responses with the persistence cookie details. Just change persist_cookie_name in the example below to the name of your persistence cookie.

    You can use logic in the following codeshare example to decode the cookie value to determine which pool member it's for. However, I'd suggest not actually decoding it in an iRule on a production unit as this could be done after the fact off of LTM (to save resources).

    http://devcentral.f5.com/wiki/default.aspx/iRules/Persistence_Cookie_Logger.html

    https://tech.f5.com/home/solutions/sol6917.html

    Also, you might check whether you have a OneConnect profile enabled on the VIP. See the OneConnect page for more info:

    http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/oneconnect.html

      
      when CLIENT_ACCEPTED {  
         log local0. "[IP::client_addr]:[TCP::client_port]: New TCP connection to [IP::local_addr]:[TCP::local_port]"  
      }  
      when HTTP_REQUEST {  
         if {[HTTP::cookie exists "persist_cookie_name"]}{  
            log local0. "[IP::client_addr]:[TCP::client_port]:  Request with persistence cookie [HTTP::cookie value "persist_cookie_name"] to [HTTP::uri]"  
         } else {  
            log local0. "[IP::client_addr]:[TCP::client_port]:  Request contains NO persistence cookie to [HTTP::uri]" 
         }  
      }  
      when LB_SELECTED {  
         log local0. "[IP::client_addr]:[TCP::client_port]: Request sent to [LB::server]"  
      }  
      when LB_FAILED {  
         log local0. "[IP::client_addr]:[TCP::client_port]: Request failed to [LB::server]"  
      }  
      when HTTP_RESPONSE {  
         if { [HTTP::cookie exists "persist_cookie_name"] }  {  
            log local0. "[IP::client_addr]:[TCP::client_port]: LTM set cookie [HTTP::cookie value "persist_cookie_name"]"   }  
      }  
      

    Aaron