If you want to parse part of the cookie value, you can use ‘string range’ (Click here) to get it. It would be good to make sure there is a value before trying to persist on it.
}timing on
HTTP responds catches the first responds from the node to back to the client.
It checking all cookies in the header and grabs all starting with 1234.
After it adds the cookie value to the persistance table and log values to syslog.
Else persist the client for 60 minutes based on source IP with /32 mask and log values to syslog.
when HTTP_RESPONSE {
foreach a_cookie [HTTP::cookie names] {
if {$a_cookie starts_with "1234"}{
persist add uie [HTTP::cookie "$a_cookie"]
log local0.debug "Cookie persist - client IP: [IP::client_addr], Cookie: $a_cookie, Server IP: [IP::server_addr]"
} else {
persist source_addr 255.255.255.255 3600
log local0.debug "Source persist - client IP: [IP::client_addr] , Server IP: [IP::server_addr], lookup [persist lookup uie [IP::client_addr]]"
}
}
}
HTTP request catches the first responds from the node to back to the client.
It checking all cookies in the header and grabs all starting with 1234.
After it persist on the cookie value in the persistance table.
Aslo, log values to syslog
when HTTP_REQUEST {
foreach a_cookie [HTTP::cookie names] {
if {$a_cookie starts_with "1234"}{
persist uie [HTTP::cookie "a_cookie"]
log local0.debug "Client IP: [IP::client_addr], Cookie value: $a_cookie"
} else {
persist uie [IP::client_addr]
log local0.debug "Source IP Persistence used - Client IP: [IP::client_addr], Persistance entries used persist uie [persist lookup uie [IP::client_addr]]"
}
}
}