Forum Discussion
Craig_Freyman_1
Nimbostratus
Feb 09, 2006Gathering Statistics
We're trying to find a way to gather information about what version of HTTP people's browsers are using on a site of ours.
We've started with this irule:
when HTTP_REQUEST {
if {([HTTP::version] == "1.0") or ([HTTP::version] == "0.9")} {
HTTP::....would be nice to post this data somewhere!
}
}
Can we shoot this information somewhere so we can look at it later?
6 Replies
- Colin_Walker_12Historic F5 AccountWell, you can certainly log it...
Add the log command to your event and you'll log the desired information for perusal later:when HTTP_REQUEST { if {([HTTP::version] == "1.0") or ([HTTP::version] == "0.9")} { log local0. "HTTP version is [HTTP::version]" } }
-Colin - Other options for storing data would be in global variables, lists, or arrays and then build an iRule that will use HTTP::respond to return the formatted results. Or you could try out the new "stats" profile introduced in 9.2. Here you can create your own statistics and fill the values from within the iRule.
citizen_elah threw up a great post on how he used it to track status codes.
http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=4925
Click here
-Joe - rapmaster_c_127Historic F5 AccountTaking a step back though, if you just want to track status codes and request versions, there's no need for an irule.
b http
should give you the stats you're looking for. - Craig_Freyman_1
Nimbostratus
Thanks for the replies.
It is working as it should. However, it is sending syslog messages for every single object that is requested on a single page, which isnt going to give us accurate stats obviously, we'd prefer only one syslog message send per visitor (assuming they match the if statement)
Make sense? - Colin_Walker_12Historic F5 AccountInteresting. Perhaps you could add another check in your if to work around this?
You could check for the first HTTP_REQUEST event fired on each connection:when RULE_INIT { set count 0 } when HTTP_REQUEST { incr count if { $count == 1 } { if {([HTTP::version] == "1.0") or ([HTTP::version] == "0.9") } { log local0. "HTTP version is [HTTP::version]" } } } when CLIENT_CLOSED { set count 0 }
Something like that might get you where you need to go. You might have to play around with it a bit.
-Colin - rapmaster_c_127Historic F5 AccountOr just pick one object on the page to log stats on, and don't log if the client is presenting an "If-Modified-Since" header in order to catch re-visitors.
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
