Forum Discussion
Brent_Sachnoff_
Nimbostratus
18 years agoUsing switch with uri
I'm having some issues using the switch command and uri's. I believe the switch command is only for EQUALS to something for it to work properly which means this wouldn't work at all. Here is a sample...
hoolio
Cirrostratus
18 years agoYou can test this by using a test string and a switch statement in the RULE_INIT event:
when RULE_INIT {
set ::test_uri /search/blah
log local0. "test string: $::test_uri"
switch -glob $::test_uri {
/search/blah* { log local0. "matched /search/blah*" }
/search/blah/foo* { log local0. "matched /search/blah*" }
/search/blah* { log local0. "matched /search/blah*" }
default { log local0. "didn't match any"}
}
}From the command line, you can run 'tail -f /var/log/ltm' to see the log statements.
If you want two different actions for /search/blah* and /search/blah/newsearch/search/*, you could either put *newsearch* before /search/blah* or make /search/blah* more specific so it doesn't match /search/blah/newsearch/search/*.
Aaron