Forum Discussion
Volker_95568
May 07, 2008Nimbostratus
Hi,
my iRule only logs Request and Responses. I pick the connection information from the environment of the HTT_Request/Response.
The iRule (jsession) is inside the following BigIP Settings:
My default persistence profile is based on the "cookie" profile.
I added "httpclass" and "oneconnect".
Last but not least I configured my own "http" profile.
This is the iRule to log events and pick up the cookie. The persist is just inserted by me, its not usable, because there should be
2 iRules, (if it could not be handled implicit by the configuration.)
1. iRule reacting on the HTTP_REQUEST by storing connection information.
2. iRule reaction on the HTTP_RESPONSE by reading connection information.
when HTTP_REQUEST {
set pers_cookie [HTTP::cookie "JSESSIONID"]
set destination [IP::remote_addr]
set source [IP::local_addr]
set d_port [TCP::remote_port]
set s_port [TCP::local_port]
log local0. "Connection $source:$s_port <- $destination:$d_port, Cookie:$pers_cookie"
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::uri] "JSESSIONID" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
}
}
when HTTP_RESPONSE {
set pers_cookie [HTTP::cookie "JSESSIONID"]
set destination [IP::remote_addr]
set source [IP::local_addr]
set d_port [TCP::remote_port]
set s_port [TCP::local_port]
log local0. "Connection $source:$s_port -> $destination:$d_port, Cookie:$pers_cookie"
if { [HTTP::cookie exists "JSESSIONID"] } {
persist add uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::payload] "JSESSIONID" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
log local0. "Findstr cookie $source:$s_port <- $destination:$d_port, Cookie:$jsess"
}
}
}