cidrmatch()
Table of Contents
| This command is experimental |
Definition
cidrmatch() takes an IP address as an argument and returns true if that IP address belongs to a given CIDR subnet.
IP and CIDR are both string arguments. If you give a literal string value instead of a column name, the value must be given inside double quotation marks.
Examples
The following example compares IP addresses with 127.0.1.1/8 and returns either 'yes' or 'no' in a separate column if there’s a match.
| makeresults count=5
| eval row=1
| accum row
| eval ip=case(row==1, "127.0.1.1", row==2, "127.0.2.2", row==3, "127.0.1.1", row==4, "127.0.2.2", row==5, "127.0.2.2")
| eval ismatch=if(cidrmatch("127.0.1.1/8",ip), "yes", "no")
|
Currently, |