Forum Discussion
Log number of times web page contains specific content?
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.
3 Replies
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 ithttp://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=66
Click here2) 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
Altostratus
Since LB::reselect cannot be used in an HTTP:RESPONSE event, can you provide guidance on how to invoke it? - Patrick_Chang_7Historic F5 AccountThe 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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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