NQL Quick Reference Guide

Field/OperatorDescriptionExample
General Formatfield operator valuedstport < 1024
Boolean Operators&& ANDLogical ANDcondition1 AND condition2
|| ORLogical ORcondition1 OR condition2
! Logical NOT !(condition)
Comparison Operators==
!=
<
<=
>
>=
Equals
Not Equals
Less than
Less than or equals to
Greater than
Greater than or equals to
field == value
field != value
field <= value
field > value
field >= value
Spacing & ParenthesesOperators must have spaces before and afterfield == value
()Use parentheses for groupingcondition1 OR (condition2 AND condition3)
Logic must be clearValid: A OR (B AND C)
Not valid: A OR B AND C
CIDR Notation/24IP fields can use CIDR notation10.0.0.0/24
Pattern MatchingWildcards, Regex, Fuzzy
=~
!~
Match pattern
Match NOT pattern
Supported FieldsFlowdstiprep.categories srciprep.categories tags
DNSanswers.rdata query.domain query.host query.name query.publicsuffix
Eventsipinfo.iprep.categories summary tags
Auditdescription
Wildcards=~ *patternMatches zero or more charactersquery.name =~ *at
!~ *patternNegative match for zero or more charactersquery.name !~ *at
=~ ?patternMatches any single characterquery.name =~ ?at
!~ ?patternNegative match for any single characterquery.name !~ ?at
Regular Expressions (Regex)=~ /pattern/Matches using regex patternquery.name =~ /pattern/
!~ /pattern/Negative match using regex patternquery.name !~ /pattern/
Regex: Text Boundary Anchors^Beginning of a line or string: Matches the start of a string^cat matches "cat" at the beginning of a string
$End of a line or string: Matches the end of a stringcat$ matches "cat" at the end of a string
Regex: Choice and GroupingxyMatches "xy"abc matches "abc"
x OR yMatches "x" or "y"ax OR ye matches "axe" or "aye"`
abc(def)?Groupingabc(def)? matches 'abc' and 'abcdef'
Regex: Repetitionx*Zero or more occurrences of "x"a* matches "", "a", "aa"
x+One or more occurrences of "x"a+ matches "a", "aa"
x?Zero or one occurrence of "x"a? matches "" or "a"
x{n,m}Between n and m occurrences of "x"a{2,4} matches "aa", "aaa", "aaaa"
x{n,}n or more occurrences of "x"a{2,} matches "aa", "aaa"
x{n}Exactly n occurrences of "x"a{3} matches "aaa"
Regex: Character Classes.Matches any single characterc.t matches "cat" and "cot"
[abc]Matches any single character in the set[aeiou] matches any vowel
[^abc]Matches any single character not in the set[^aeiou] matches consonants
[a-z]Matches any single character in the range[a-z] matches any lowercase letter
Regex: Numeric Ranges<0-10>
<00-010>
Matches a numeric range
Matches a numeric range with leading 0s
<0-10> matches any number from 0 to 10
Regex: Special Characters\Escapes special characters to be treated as literals\. matches a literal period
Regex: Reserved Characters. ? + * OR { } [ ] ( ) " \\
Fuzzy Matching=~ term~Matches using fuzzy logicquery.name =~ cat~
!~ term~Negative fuzzy matchquery.name !~ cat~
=~ term~2Matches terms with a maximum distance of 2 changesquery.name =~ cat~2
!~ term~2Negative match with a maximum distance of 2 changesquery.name !~ cat~2

See Using NQL for more detailed information.