Forum Discussion
Parse datagroup values as a list
I have a datagroup which I am testing each element of:
foreach item [class names my-dg] {
if { [string match -nocase $item $teststring] } {
Unfortunately, if the datagroup elements have asterisks in them your config won't load if mcpd does a forceload or you are updating the software (even though you can enter these entries through the GUI, or through tmsh if they are escaped with a "\").
Anyway, I need to rewrite the rule, so I thought I'd just put all the names as values and have an arbitrary name such as a sequence number.
Can someone suggest a simple way to load the datagroup values as a list, so I can just loop through with a foreach, or some other efficient method of checking each value?
1 Reply
- Kevin_Stewart
Employee
Use class get. It'll produce a list of the keys and values, or rather a list of lists.
when HTTP_REQUEST { set mylist [class get biglist] foreach x $mylist { log local0. "[lindex $x 0] : [lindex $x 1]" } }
Recent Discussions
Related Content
* 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