Forum Discussion

Arie's avatar
Arie
Icon for Altostratus rankAltostratus
Jul 06, 2007

Log number of times web page contains specific content?

We're running ColdFusion, which sends a specific string to the browser ("<.") when it's in the process of restarting. Since it takes the LTM a few seconds to catch this I have two questions:

 

 

1) How can we log the number of times this happens?

 

 

2) How can we select another node when this happens (other than utilizing a monitor)? My thinking is that if we examine the content and find this string (which is the sole content of a page when the restart occurs) we should be able to select another node instantaneously.
  • 1) How can we log the number of times this happens?

     

     

     

    You can query the HTTP::payload in your HTTP_RESPONSE event and search for this string of characters. Then, simply by using the log command you can log a message to the system log. This won't keep a count for you, but it will give you a timestamp for each occurrence and from that you could build a rate calculation by pulling out all the entries.

     

     

    If you just want a raw count (and you are above v9.2), you can use the Statistics Profile to store values from within iRules. See this tech tip on how to do it

     

     

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

     

    Click here

     

     

     

    2) How can we select another node when this happens (other than utilizing a monitor)? My thinking is that if we examine the content and find this string (which is the sole content of a page when the restart occurs) we should be able to select another node instantaneously.

     

     

     

    For this you'll have to search the HTTP::payload from the HTTP_RESPONSE event and if you find this condition, you can use LB::reselect along with the HTTP::retry command to retry the request to another backend resource. Here's a post that goes over the LB::reselect command:

     

     

    http://devcentral.f5.com/default.aspx?tabid=53&view=topic&forumid=5&postid=5201

     

    Click here

     

     

     

    Hope this helps...

     

     

    -Joe
  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Since LB::reselect cannot be used in an HTTP:RESPONSE event, can you provide guidance on how to invoke it?
  • Patrick_Chang_7's avatar
    Patrick_Chang_7
    Historic F5 Account
    The example shows the LB::reselect called in a when LB_SELECTED event in the same iRule. You will enter the LB_SELECTED event when you hit the HTTP::retry.