Forum Discussion
Karlsen_58024
Nimbostratus
Oct 03, 2012iRule hitcount logging
Hello DevCentral,
I have an iRule for redirection based on host headers. I want to make a hit count on each host header. Is this possible?
when HTTP_REQUEST {
if { [HTTP::hos...
nitass
Employee
Oct 03, 2012istats
Introduction to iStats Part 1: Overview by Colin
https://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1088514/Introduction-to-iStats-Part-1-Overview.aspx
e.g.
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.19.252:80
ip-protocol tcp
mask 255.255.255.255
profiles {
http { }
tcp { }
}
rules {
myrule
}
snat automap
vlans-disabled
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when HTTP_REQUEST {
ISTATS::incr "ltm.virtual /Common/bar counter [HTTP::host]" 1
if { [HTTP::host] contains "example.com" } {
HTTP::redirect "https://www.secureexample.com[HTTP::uri]"
}
if { [HTTP::host] contains "example.no" } {
HTTP::redirect "https://www.secureexample.no[HTTP::uri]"
}
if { [HTTP::host] contains "example.dk" } {
HTTP::redirect "https://www.secureexample.dk[HTTP::uri]"
}
}
}
[root@ve11a:Active:Changes Pending] config tmsh show ltm virtual bar
---------------------------------------------------------
Ltm::Virtual Server: bar
---------------------------------------------------------
Status
Availability : unknown
State : enabled
Reason : The children pool member(s) either don't have service checking enabled, or service check results are not available yet
CMP : enabled
CMP Mode : all-cpus
Destination : 172.28.19.252:80
Traffic ClientSide Ephemeral General
Bits In 30.4K 0 -
Bits Out 21.8K 0 -
Packets In 48 0 -
Packets Out 32 0 -
Current Connections 0 0 -
Maximum Connections 1 0 -
Total Connections 8 0 -
Min Conn Duration/msec - - 3
Max Conn Duration/msec - - 5
Mean Conn Duration/msec - - 4
Total Requests - - 0
CPU Usage Ratio (%)
Last 5 Seconds 0
Last 1 Minute 0
Last 5 Minutes 0
User-defined Value
example.com 1
example.dk 2
example.no 1
test.example.com 1
www.example.com 1
www.example.dk 1
www.example.no 1
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects