null
The null value in Cribl Search can indicate:
- The absence of a field or value.
- A type mismatch in a conversion, operation, or function. For example,
toint('abc')and123 / 'hello'both evaluate tonullbecause strings can’t be converted to numbers.
null and Missing Fields
When an expression references a field that an event doesn’t contain, Cribl Search returns null for that field instead
of dropping the field from the event. This applies to the project, extend, and
summarize operators.
For example, the foo field doesn’t exist in the $vt_dummy Dataset, so the following query returns bar as null in
every event:
dataset="$vt_dummy" event<5
| project event, bar=fooBecause Cribl Search keeps the field, every event in the results has the same set of fields, whether or not the source
data supplied a value. To drop the events that have no value, filter them out with isnotnull.
null Literals
A null literal is represented in Cribl Search as null. For example:
where field==nullextend result=iff(value > 100, value, null)
null Equality and Inequality
Cribl Search supports the null value in equality/inequality comparisons. These comparisons are equivalent to using the
isnull and isnotnull functions.
This is different from standard Kusto Query Language (KQL), which returns
nullif both sides of the comparison arenull.
See the following examples:
| Expression | Result |
|---|---|
5 == null | false |
5 != null | true |
null == 5 | false |
'abc' == null | false |
'null' == null | false |
0 == null | false |
int('abc') == null | true |
int('abc') == int('def') | true |
null and Strings
Cribl Search supports the null value in string comparisons.
This is different from standard Kusto Query Langauge (KQL), which does not allow the
nullvalue for strings.
See the following examples:
| Expression | Result |
|---|---|
tostring(null) | null |
string(null) | null |
isnull('abc') | false |
'abc' == null | false |
null and Binary Operators
Binary operators are those that perform an operation on two values. These operators include and, or, ==, !=,
>=, <=, numeric operators (+, -, *), and others.
If one or both of the values passed to the binary operator are null, then the output of the binary operator is also
null. For example, null + 10 returns null.
Exceptions to the rule above are:
- For the equality
==and inequality!=operators, either or both sides of the operation can benull, and will returntrueorfalserather thannull(as described innullEquality and Inequality). - For the logical
ANDoperator, if one of the values isfalse, the result is alsofalse. - For the logical
ORoperator, if one of the values istrue, the result is alsotrue.
See the following examples:
| Expression | Result |
|---|---|
5 > 3 | true |
null > 3 | null |
null > int('abc') | null |
null == int('abc') | true |
null >= int('abc') | true |
null >= 3 | null |
null > int('abc') | null |
10 + null | null |
10 + 'abc' | null |
10 - '' | null |
10 - null | null |
10 + unknown_field | null |
10 - toint('abc') | null |
null * 10 | null |
null > 3 and true | null |
null > 3 and false | false |
null > 3 or true | true |
null > 3 or false | null |
null and the where Operator
The where operator treats null as false. This means that events with conditions evaluating to null
won’t appear in the search results.
For example, dataset="foo" | where tobool("abc") returns no results because tobool("abc") evaluates to null.
null and Distinct Counts
The dcount and dcountif aggregation functions don’t count null toward the number of distinct
values. If every value in a summary group is null, these functions return 0.
null and the Logical NOT Operator
If the value passed to the logical NOT (!) operator is null, then the output is also null.
| Expression | Result |
|---|---|
not(true) | false |
not(false) | true |
not(null) | null |
not(int('abc')) | null |
!int('abc') | null |