Forum Discussion

Joe_Erchul_4263's avatar
Joe_Erchul_4263
Icon for Nimbostratus rankNimbostratus
Jan 22, 2010

Counting unique web sessions via iRule?

All,

 

 

I'm looking for some guidance on how to count unique web sessions hitting a specific GET request on a VIP during a specific period of time. I'm trying to script something that our NOC can execute which would reset a counter to zero, begin counting sessions at either a pre-set time or through some interaction, then stop counting when the presentation is complete (NOC interaction). I looked into using the "Statistics" tab to gather this information, but I don't believe that this will give me a correct total even if I clear the counters first.

 

 

Any input is appreciated.

 

 

Thanks.

 

 

Joe

 

3 Replies

  • Hi Joe,

     

     

    Do you want to count app sessions or just individual GET requests to a specific URI?

     

     

    Which LTM version are you running? The options vary a bit depending on which version you're running.

     

     

    In general, you could use an iRule to increment a stats profile each time the condition you want to check for is reached. You could add a "secret" URI which allows an admin to reset the stats. Similarly you could enable/disable the counting if a specific URI is accessed. You could limit access to these URIs based on source IP or some other request characteristic.

     

     

    Here is an article from Joe with a great example of using an iRule and stats profile together:

     

     

    Custom Reporting with iRules

     

    http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=66

     

     

    Aaron
  • Aaron,

     

     

    I'm looking to count discrete app sessions based on hitting the homepage "GET" on the VIP. I'm going to configure this on our 9.4.8 version of LTM, but will be upgrading that pair to 10.1 within the next few months, so hopefully the code will transfer over correctly. I'll take a look at Joe's article.

     

     

    Thanks for the help.

     

     

    Joe
  • You could insert a session cookie in responses if it didn't exist already in the request, and use that to count the requests following Joe's example in the article. In version before 10.1.x, it would be difficult to track all client sessions over a period of time as you can't count practically session table entries and can't efficiently time out entries from an array you manually create. The options for session counting using the table command (Click here) and the session table.

     

     

    Aaron