Condition Operations
cidrmatch
Description: Returns true
or false
depending on whether the value matches the sampling condition.
In the example, ret
is assigned the value true
.
... | eval ipa="192.168.3.2", ret=cidrmatch("192.0.0.0/8", ipa)
In the example, ret
is assigned the value false
.
... | eval ipa="10.22.3.2", ret=cidrmatch("192.0.0.0/8", ipa)
coalesce
Description: Returns the first non-null value from the list of variables. The order of checking is according to the specified list of fields in the query.
In the example, res
will be the first non-null value of the variables user
, message
, message2
.
... | eval res=coalesce(user,message,message2)
in
Description: Returns true
if the field contains the search value(s), or false
if no matches are found.
In the example, user
has the value "Alexander"
, and res
is assigned the value true
.
... | eval res=in(user, "Aleksey", "Ilya", "Alexander")
In the example, user
has the value "Alexander"
, and res
is assigned the value false
.
... | eval res=in(user, "Aleksey", "Ilya")
like
Description: Returns true
if the field matches the pattern, or false
if no matches are found.
In the example, user
has the value "Alexander"
, and res
is assigned the value true
.
... | eval res=like(user, "Ale%")
In the example, user
has the value "Alexander"
, and res
is assigned the value false
.
... | eval res=like(user, "Alek%")
match
Description: Returns true
if the field matches a Java regex, or false
if no matches are found.
In the example, testVal
has the value "hello world"
, and res
is assigned the value true
.
... | eval res=match(testVal, "^([a-zA-Z].*)")
In the example, testVal
has the value "hello world"
, and res
is assigned the value false
.
... | eval res=match(testVal, "^([a-zA-Z]*)")