Forum Discussion
Beard_126011
Nimbostratus
Jul 29, 2015Cookie Counting
Hi,
im looking for someone who could kindly point me in the right direction to produce an IRule that will:-
For each request count the number of cookies that exist in that request and log the followi...
VernonWells
Employee
Jul 29, 2015If by "session", you mean TCP connection, there is an alternate way to accomplish this:
when CLIENT_ACCEPTED {
set client "[IP::client_addr]:[TCP::client_port]"
}
when HTTP_REQUEST {
if { ![info exists ccount] } {
set ccount [HTTP::cookie count]
} else {
incr ccount [HTTP::cookie count]
}
if { [HTTP::header exists User-Agent] } {
set ua [HTTP::header User-Agent]
}
}
when SERVER_CLOSED {
if { ![info exists ua] } {
set ua ""
}
log local0. "Client: ($client), Cookies: ($ccount), UA: ($ua)"
}
This assumes that the User-Agent doesn't change over the lifetime of the TCP connection, which is generally a valid assumption.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects