Forum Discussion

dlg_23340's avatar
dlg_23340
Icon for Cirrus rankCirrus
Nov 23, 2011

"class match starts_with" behavior

My own testing seems to indicate that the return of [class match -value -- $var starts_with data_group] returns the value of the longest key, but I can't find any documentation to support this. Can anyone provide the expected behavior in this case?

 

8 Replies

  • i have seen ID222001 "class match" and "class search" need "-all" parameter which mentioning the first entry will be returned but as i tested, i got the same result as yours. not sure if i missed anything. does another guy get similar result??

     

     

    [root@ve1023:Active] config b rule myrule list

     

    rule myrule {

     

    when RULE_INIT {

     

    log local0. "foo: [class get foo]"

     

    for {set i 0} {$i < [class size foo]} {incr i} {

     

    log local0. "index$i: [class element $i foo]"

     

    }

     

    log local0. "\[class match -value abcdef starts_with foo\]: [class match -value abcdef starts_with foo]"

     

    }

     

    }

     

    [root@ve1023:Active] config b class foo list

     

    class foo {

     

    {

     

    "ab" { "333" }

     

    "abc" { "111" }

     

    "abcd" { "222" }

     

    }

     

    }

     

     

    [root@ve1023:Active] config tail /var/log/ltm

     

    Nov 23 13:48:04 local/ve1023 err mcpd[21973]: 01020066:3: The requested rule (myrule) already exists in partition Common.

     

    Nov 23 13:48:05 local/tmm info tmm[23027]: Rule myrule : foo: {abc 111} {abcd 222} {ab 333}

     

    Nov 23 13:48:05 local/tmm info tmm[23027]: Rule myrule : index0: abc 111

     

    Nov 23 13:48:05 local/tmm info tmm[23027]: Rule myrule : index1: abcd 222

     

    Nov 23 13:48:05 local/tmm info tmm[23027]: Rule myrule : index2: ab 333

     

    Nov 23 13:48:05 local/tmm info tmm[23027]: Rule myrule : [class match -value abcdef starts_with foo]: 222

     

     

  • i have seen ID222001 "class match" and "class search" need "-all" parameter which mentioning the first entry will be returnedsorry i was wrong. ID222001 is correct. what your finding is different one.

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when RULE_INIT {
            log local0. "foo: [class get foo]"
            for {set i 0} {$i < [class size foo]} {incr i} {
                    log local0. "index$i: [class element $i foo]"
            }
            log local0. "\[class match -value abcdef starts_with foo\]: [class match -value abcdef starts_with foo]"
            log local0. "\[class search -value foo starts_with abcdef\]: [class search -value foo starts_with ab]"
    }
    }
    
    [root@ve1023:Active] config  tail -f /var/log/ltm
    Nov 25 19:21:00 local/ve1023 err mcpd[21973]: 01020066:3: The requested rule (myrule) already exists in partition Common.
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : foo: {abc 111} {abcd 222} {ab 333}
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : index0: abc 111
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : index1: abcd 222
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : index2: ab 333
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : [class match -value abcdef starts_with foo]: 222
    Nov 25 19:21:00 local/tmm info tmm[23027]: Rule myrule : [class search -value foo starts_with abcdef]: 111
    
    
  • hat is ID222001?it is a request to add -all parameter to return all matches when using class match or class search.

     

     

    regarding your question, i cannot find any document too.
  • Ok, let me rephrase. Where do you find "ID222001"? Is that in internal F5 tracking ID?
  • Is that in internal F5 tracking ID?yes, it is internal.
  • Posted By nitass on 11/28/2011 06:24 AM

     

    yes, it is internal.

     

    Which means I don't get to see it. So this behavior isn't documented anywhere. This makes my life hard - I'm trying to sell an irule rewrite to one of our biggest internal customers that's dependent on this behavior, and they're not going to take a "well, trust me, I tested it" in lieu of "this is where it is documented by F5".

     

     

    Thanks for validating the behavior, nitass.

     

  • not really. you may open a support case and ask for confirmation and/or document. they should be able to help you.