Forum Discussion
Slight modified existing iRule. you can write something like below....
when RULE_INIT {
Change to "1" to enable debugging log statements
set static::Poolxyz_select_debug 0
}
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] contains "api-dev" } {
switch -glob [string tolower [HTTP::uri]] {
"/someuri" { pool XYZ }
default { pool big_pool }
}
if { $static::Pool_select_debug eq 1 } {
log local0. "[IP::client_addr] with URI of [HTTP::uri] went to XYZ Pool"
}
}
}
- Wackitron_36350Jul 23, 2018Altocumulus
Thank You for the quick response. It looks like this above IRule is working, I do not see the failures on the Statistics Tab. But on the /var/log/ltm, It is hard to trace the URI being redirected to diff pool. Because Other URIs which we did not mention in the Irule also logged as IP with /xyz or /someuri went to the XYZ Pool. It would be easier if we set up a variable for the Pool.
Thank You again for the help.
- Samir_Jha_52506Jul 23, 2018Noctilucent
Cool, because traffic is going to default pool if uri didn't match. Plz modify URI in lower case('/someuri') and comments these lines in iRule. Rest no change...
default { pool big_pool }
Update the comments... Cheers...
- Wackitron_36350Jul 23, 2018Altocumulus
Thanks again, I will do that. Also wondering If we can log someruri to XYZ Pool and the rest uris to default pool. Makes lot easier for debugging. Also I will ask the QA to run the tests tomorrow and confirm here if it was successful.
- Samir_Jha_52506Jul 23, 2018Noctilucent
I guess, you are looking something like this. Just validate it n update us..
when RULE_INIT { Change to "1" to enable debugging log statements set static::Poolxyz_select_debug 0 } when HTTP_REQUEST { if {[string tolower [HTTP::host]] contains "api-dev" } { switch -glob [string tolower [HTTP::uri]] { "/someuri" { HTTP::uri "[HTTP::uri]" pool XYZ } default { HTTP::uri "[HTTP::uri]" pool big_pool } } if { $static::Pool_select_debug eq 1 } { log local0. "[IP::client_addr] with URI of [HTTP::uri] went to XYZ Pool" } } }
- Wackitron_36350Jul 23, 2018Altocumulus
Apologies, I did not explain the issue correctly, the above two Irules have no failures on the GUI Stats, but in the logs of /var/log/ltm, it is logging other uris went to xyz pool but no logs for the /someuri went to xyz pool.
- Wackitron_36350Aug 13, 2018Altocumulus
I was on vacation, could not test my rule.
"/someuri" { HTTP::uri "[HTTP::uri]" -------> At here, I need something like URI starts with "/cars/name" and ends with "/brand" in the switch glob. I really appreciate the help. Thanks in advance.