Forum Discussion
vallesm77_95699
Nimbostratus
Feb 14, 2012foreach v11
hello,
I want to check in dataGroup the correspondence between URI and all records to my DataGroup
foreach entry [class get $ActionBasedOnUrl] {
log local0. "$theurl starts_with [getfield $entry " " 1]"
if { $theurl starts_with [getfield $entry " " 1]} {
set new_len [string length [getfield $entry " " 1]]
if {$new_len > $match_len} {
set myrow $entry
set match_len $new_len
}
}
}
if { $theurl starts_with [getfield $entry " " 1]} don't work because [getfield $entry " " 1] return always the record with de prefix"{"
Tue Feb 14 14:10:11 CET 2012 info tmm tmm[6817] Rule /Common/WLS : / starts_with {/
How to get the record without the prefix " { " ?
Thanks
- nitass
Employee
is there anything i missed?root@ve1110(Active)(/Common)(tmos) list ltm data-group internal ActionBasedOnUrl ltm data-group internal ActionBasedOnUrl { records { /hungry { data go-7-11 } /sleepy { data go-home } } type string } root@ve1110(Active)(/Common)(tmos) list ltm rule myrule ltm rule myrule { when RULE_INIT { log local0. "\[class get ActionBasedOnUrl\]: [class get ActionBasedOnUrl]" foreach entry [class get ActionBasedOnUrl] { log local0. "\[getfield $entry \" \" 1\]: [getfield $entry " " 1]" } } } [root@ve1110:Active] config cat /var/log/ltm Feb 14 06:07:37 tmm info tmm[7321]: Rule /Common/myrule : [class get ActionBasedOnUrl]: {/hungry go-7-11} {/sleepy go-home} Feb 14 06:07:37 tmm info tmm[7321]: Rule /Common/myrule : [getfield /hungry go-7-11 " " 1]: /hungry Feb 14 06:07:37 tmm info tmm[7321]: Rule /Common/myrule : [getfield /sleepy go-home " " 1]: /sleepy
- vallesm77_95699
Nimbostratus
thanks for your response. - nitass
Employee
root@ve1110(Active)(/Common)(tmos) list ltm data-group internal ActionBasedOnUrl ltm data-group internal ActionBasedOnUrl { records { "/ wls cookie1 pool_internet" { } "/docs wls cookie2 pool_internet" { } } type string } root@ve1110(Active)(/Common)(tmos) list ltm rule myrule ltm rule myrule { when RULE_INIT { set init [class get ActionBasedOnUrl] log local0. $init foreach entry $init { log local0. $entry foreach item $entry { if {$item ne ""} { for {set i 0} {$i < [llength $item]} {incr i} { log local0. [lindex $item $i] } } } } } } [root@ve1110:Active] config cat /var/log/ltm Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : {{/ wls cookie1 pool_internet} {}} {{/docs wls cookie2 pool_internet} {}} Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : {/ wls cookie1 pool_internet} {} Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : / Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : wls Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : cookie1 Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : pool_internet Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : {/docs wls cookie2 pool_internet} {} Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : /docs Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : wls Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : cookie2 Feb 14 06:59:34 tmm info tmm[7321]: Rule /Common/myrule : pool_internet
- vallesm77_95699
Nimbostratus
Thank you very much. - nitass
Employee
Please, can you to explain to me the lines :root@ve1110(Active)(/Common)(tmos) list ltm rule myrule ltm rule myrule { when RULE_INIT { set init [class get ActionBasedOnUrl] log local0. "\$init: $init" foreach entry $init { log local0. "\$entry: $entry" foreach item $entry { if {$item ne ""} { log local0. "\$item: $item" foreach x $item { log local0. "\$x: $x" } } } } } } [root@ve1110:Active] config cat /var/log/ltm Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $init: {{/ wls cookie1 pool_internet} {}} {{/docs wls cookie2 pool_internet} {}} Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $entry: {/ wls cookie1 pool_internet} {} Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $item: / wls cookie1 pool_internet Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: / Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: wls Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: cookie1 Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: pool_internet Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $entry: {/docs wls cookie2 pool_internet} {} Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $item: /docs wls cookie2 pool_internet Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: /docs Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: wls Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: cookie2 Feb 14 08:32:49 tmm info tmm[7321]: Rule /Common/myrule : $x: pool_internet
- nitass
Employee
And, after, If want to "recreate" a new variable wich contains on the same line all the values. iRules 101 - 15 - TCL List Handling Commands by Jason - vallesm77_95699
Nimbostratus
Thanks It's perfect
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