Cortex XQL Command Reference

Cortex XQL (Extended Query Language) is a powerful query language used in the Cortex platform for threat hunting, investigation, and analytics across your security data. This reference provides comprehensive documentation for all XQL functions and pipeline stages.

XQL queries are composed of stages connected in a pipeline, with functions used within those stages to transform, filter, and analyze data. This reference is organized into two main sections:

  • Functions – Built-in functions, indexes, and detailed reference pages.
  • Stages – Pipeline stages, indexes, and detailed reference pages.

Functions

Function Description
acos Calculate the inverse cosine (arccosine) of a numerical expression
add  
approx_count  
approx_quantiles  
approx_top  
asin Calculate the inverse sine (arcsine) of a numerical expression
array_all  
array_any  
array_length  
arrayconcat  
arraycreate  
arraydistinct  
arrayfilter  
arrayindex  
arrayindexof  
arraymap  
arraymerge  
arrayrange  
arraystring  
avg  
avg  
bitwise_and Perform a bitwise AND operation between two integer values
bitwise_or Perform a bitwise OR operation between two integer values
bitwise_sleft Perform a bitwise left shift operation on an integer value
bitwise_sright Perform a bitwise right shift operation on an integer value
bitwise_xor Perform a bitwise exclusive OR (XOR) operation between two integer values
cbrt Calculate the cube root of a numeric value
ceil Round a number up to the nearest integer
coalesce  
concat  
convert_from_base_64  
convert_to_base_64  
cos Calculate the cosine of a numeric value specified in radians
cosine_distance Calculate the cosine distance between two numeric vectors
cot Calculate the cotangent of a numeric value specified in radians
count  
count  
count_distinct  
csc Calculate the cosecant of a numeric value specified in radians
current_time  
date_floor  
divide  
earliest  
euclidean_distance Calculate the Euclidean distance between two numeric vectors
exp Calculate the value of e raised to the power of a numeric value
extract_time  
extract_url_host  
extract_url_pub_suffix  
extract_url_registered_domain  
first  
first_value  
floor  
format_string  
format_timestamp  
greatest Return the largest value from a list of expressions
if  
incidr  
incidr6  
incidrlist  
int_to_ip  
ip_to_int  
is_ipv4  
is_ipv6  
is_known_private_ipv4  
is_known_private_ipv6  
json_extract  
json_extract_array  
json_extract_scalar  
json_extract_scalar_array  
json_path_extract  
json_functions_reference A comprehensive guide to the four JSON extraction functions
lag  
last  
last_value  
latest  
least Return the smallest value from a list of expressions
len  
list (comp) Collect all values of a field and return them as an array within the comp stage
ln Calculate the natural logarithm (base e) of a numeric value
log Calculate the logarithm of a numeric value with a specified base
log10 Calculate the base-10 logarithm of a numeric value
lowercase  
ltrim  
max (comp) Return the maximum value of a field within the comp stage
max (windowcomp) Compute the maximum value of a field over a window of rows within the windowcomp stage
md5  
median (comp) Return the median value of a numeric field within the comp stage
median (windowcomp) Compute the median value of a numeric field over a window of rows within the windowcomp stage
min (comp) Return the minimum value of a field within the comp stage
min (windowcomp) Compute the minimum value of a field over a window of rows within the windowcomp stage
mod Calculate the remainder (modulus) of the division of two numeric values
multiply  
object_create  
object_merge  
parse_epoch  
parse_timestamp  
pow  
power Raise a number to the power of another number (alias for pow)
rand Generate a pseudo-random floating-point number between 0 and 1
range_bucket Determine which bucket a numeric value falls into given an array of boundaries
rank (windowcomp) Assign a rank to each row within a partition in the windowcomp stage
regexcapture  
regextract Extract a substring from a field value using a regular expression pattern
replace  
replex  
round  
row_number (windowcomp) Assign a unique sequential integer to each row within a partition in the windowcomp stage
rtrim  
safe_add Perform addition with overflow protection, returning null on overflow
safe_divide Perform division with error protection, returning null on division by zero
safe_multiply Perform multiplication with overflow protection, returning null on overflow
safe_negate Negate a numeric value with overflow protection, returning null on overflow
safe_subtract Perform subtraction with overflow protection, returning null on overflow
sec Calculate the secant of a numeric value specified in radians
sha1  
sha256  
sha512  
sign Determine the sign of a numeric value (-1, 0, or 1)
sin Calculate the sine of a numeric value specified in radians
split  
sqrt Calculate the square root of a numeric value
stddev_population (comp) Compute the population standard deviation of a numeric field within the comp stage
stddev_population (windowcomp) Compute the population standard deviation of a numeric field over a window of rows within the windowcomp stage
stddev_sample (comp) Compute the sample standard deviation of a numeric field within the comp stage
stddev_sample (windowcomp) Compute the sample standard deviation of a numeric field over a window of rows within the windowcomp stage
string_count  
subtract  
sum (comp) Compute the sum of a numeric field within the comp stage
sum (windowcomp) Compute the sum of a numeric field over a window of rows within the windowcomp stage
tan Calculate the tangent of a numeric value specified in radians
time_frame_end  
timestamp_diff  
timestamp_seconds  
to_boolean  
to_epoch  
to_float  
to_integer  
to_json_string  
to_number  
to_string  
to_timestamp  
trim  
trunc Truncate a numeric value to a specified number of decimal places
uppercase  
values Collect all distinct values of a field and return them as an array within the comp stage
var Compute the variance of a numeric field within the comp stage
wildcard_match  

Stages

Stage Description
alter  
arrayexpand  
bin  
call  
comp  
config  
dataset  
dedup  
fields  
filter  
iploc  
join  
limit  
presets  
replacenull  
search  
sort  
tag  
target  
top  
transaction  
union  
view  
windowcomp