isNull, isEmpty, isBlank Search Operators
- The
isNulloperator checks a string and returns a boolean value: true if the string is null, or false if the string is not null. - The
isEmptyoperator checks if a string contains no characters and is only whitespace. - The
isBlankoperator checks if a string contains no characters, is only whitespace, and is null.
When is a field null?
Fields can hold a null value for the following reasons:
- A parsing operation failed to parse a value.
- There is a mismatch from a
lookupoperator query. - There is a missing field from a geo lookup operator query.
- There is a missing field from a
transposeoperator query.
When to use isNull, isEmpty, isBlank
isNull(<string>)
Checks if the <string> value is "null".
isNull(null) = trueisNull("") = falseisNull(" ") = falseisNull("bob") = falseisNull(" bob ") = false
Returns true if the string is null.
isEmpty(<string>)
Checks if the <string> value is an empty string containing no characters or whitespace.
isEmpty(null) = trueisEmpty("") = trueisEmpty(" ") = falseisEmpty("bob") = falseisEmpty(" bob ") = false
Returns true if the string is null or empty.
isBlank(<string>)
Checks if the value is null, empty, or contains only whitespace characters.
isBlank(null) = trueisBlank("") = trueisBlank(" ") = trueisBlank("bob") = falseisBlank(" bob ") = false
Returns true if the string is null, empty, or only whitespace.
Examples
Run a geo lookup query where we can find remote IP addresses that are not in the geo database
In this situation, no country_code will be associated with the IP address and the field value will be null.
Running a query like:
| parse "remote_ip=*]" as remote_ip
| lookup country_code from geo://location on ip = remote_ip
| if (isNull(country_code), "unknown", country_code) as country_code
uses the isNull operator to check the field value of country_code and if it returns true, has the if operator replace the value with the string unknown:

Use the where operator to check for null values
To check for null values from a lookup operation, use a query with where, like:
| parse "example_ip=*]" as ip
| lookup country_name, city from geo://location on ip = ip
| where isNull(country_name)