Forum Discussion

Sergio000_19532's avatar
Sergio000_19532
Icon for Nimbostratus rankNimbostratus
Jan 19, 2018

Datagroup into variable

Hi I am making an Irule and I need to set the value of a datagroup into a variable. Something like this

 

set url [RESOLV::lookup @8.8.8.8 domains]

 

I want that the varaible url gets the value of the dns result the datagroup domains.

 

Please help

 

  • In this example, you have a datagroup called 'domains' and a record, 'mydomain.com' which has a value of '10.1.1.1'

     

     ltm data-group internal domains {
            records {
                mydomain.com {
                    data 10.1.1.1
                }
            }
            type string
        }
    

     

    In an iRule, you can use the -value switch to return the value in a datagroup, rather than a Boolean match when using the class command

    The following code will set a variable 'url' to '10.1.1.1'

    set url [class match -value "mydomain.com" equals "domains"]