Forum Discussion

Craig_Freyman_1's avatar
Craig_Freyman_1
Icon for Nimbostratus rankNimbostratus
Feb 09, 2006

Gathering 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_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Well, 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_127's avatar
    rapmaster_c_127
    Historic F5 Account
    Taking 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.
  • 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_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Interesting. 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_127's avatar
    rapmaster_c_127
    Historic F5 Account
    Or 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.