cancel
Showing results for 
Search instead for 
Did you mean: 
Kirk_Bauer_1018
Nimbostratus
Nimbostratus

Problem this snippet solves:

Have you ever wondered what types of content are served by your web servers? Have you wondered how many requests could be offloaded to the BIG-IP if you added the RAM Cache module? Or maybe how much acceleration you may get from WebAccelerator? Try out this iRule. Most of the time everything other than the HTML pages should be cacheable.

How to use this snippet:

This iRule requires LTM v10. or higher.

Code :

# First, create statistics profile named "ContentType" with following entries:
#   HTML
#   Images
#   Scripts
#   Documents
#   Stylesheets
#   Other
# Now associate this Statistics Profile to the virtual server.  Then apply the following iRule.
# To view the results, go to Statistics -> Profiles - Statistics

when HTTP_RESPONSE {
   switch -glob [HTTP::header "Content-type"] {
      "image/*"         { STATS::incr "ContentType" "Images" }
      "text/html"       { STATS::incr "ContentType" "HTML" }
      "text/css"        { STATS::incr "ContentType" "Stylesheets" }
      "*javascript"     -
      "text/vbscript"   { STATS::incr "ContentType" "Scripts" }
      "application/pdf" -
      "application/msword" -
      "application/*powerpoint" -
      "application/*excel" { STATS::incr "ContentType" "Documents" }
      "default"         { STATS::incr "ContentType" "Other" }
   }
}

Tested this on version:

10.0
Version history
Last update:
‎17-Mar-2015 12:17
Updated by:
Contributors