Forum Discussion
nelson_ge_10908
Jan 31, 2005Historic F5 Account
How to log URL with iRule
I am load balancing 2 proxy servers with widecard vip and need to log the client IP and the URL with iRule. Does this rule look right?
when HTTP_REQUEST {
if {[IP::local_addr] equals 0.0.0.0}
log local7.info remote_addr URI::basename
}
3 Replies
- nelson_ge_10908Historic F5 AccountYes this help, thanks.
The reason I put an "if" statement is for testing purpose.
I think I only want to turn logging on when troubleshooting, and I don't want to log every single request, that wouldn't be too much to log.
How would I modify the following line if I want to look for source_URL=www.xyz.com instead source_ip=1.2.3.4?
if { [IP::addr [IP::local_addr] equals "1.2.3.4"] } - nelson_ge_10908Historic F5 AccountSorry, I meant destination_URL=www.xyz.com instead source_ip=1.2.3.4?
If there are multiple IPs tied to the single URL at destination, such as in 3DNS scenario, it would be easier to match URL than IP. - unRuleY_95363Historic F5 AccountPretty simple, you get at the destination Host via the [HTTP::host] command. So, in a rule:
when HTTP_REQUEST { if { [HTTP::host] eq "www.xyz.com" } { pool xyz_pool } }
or if you want to get a little fancy:when HTTP_REQUEST { if { [domain [HTTP::host] 2] eq "xyz.com" } { pool xyz_pool } }
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
