Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Introduction

Query reference overview

APL

IntroductionSample queriesAll features
Functions
Scalar functions
Array functions
Overview
array_concat
array_extract
array_iff
array_index_of
array_length
array_reverse
array_rotate_left
array_rotate_right
array_select_dict
array_shift_left
array_shift_right
array_slice
array_sort_asc
array_sort_desc
array_split
array_sum
bag_has_key
bag_keys
bag_pack
bag_zip
isarray
len
pack_array
pack_dictionary
strcat_array
Conditional functions
Overview
case
iff
Conversion functions
Overview
dynamic_to_json
ensure_field
isbool
toarray
tobool
todatetime
todouble, toreal
todynamic
tohex
toint, tolong
tostring
totimespan
Datetime functions
Overview
ago
datetime_add
datetime_diff
datetime_part
dayofmonth
dayofweek
dayofyear
endofday
endofmonth
endofweek
endofyear
getmonth
getyear
hourofday
monthofyear
now
startofday
startofmonth
startofweek
startofyear
unixtime_microseconds_todatetime
unixtime_milliseconds_todatetime
unixtime_nanoseconds_todatetime
unixtime_seconds_todatetime
week_of_year
GenAI functions
Overview
genai_concat_contents
genai_conversation_turns
genai_cost
genai_estimate_tokens
genai_extract_assistant_response
genai_extract_function_results
genai_extract_system_prompt
genai_extract_tool_calls
genai_extract_user_prompt
genai_get_content_by_index
genai_get_content_by_role
genai_get_pricing
genai_get_role
genai_has_tool_calls
genai_input_cost
genai_is_truncated
genai_message_roles
genai_output_cost
Hash functions
Overview
hash
hash_md5
hash_sha1
hash_sha256
hash_sha512
IP functions
Overview
format_ipv4
format_ipv4_mask
geo_info_from_ip_address
has_any_ipv4
has_any_ipv4_prefix
has_ipv4
has_ipv4_prefix
ipv4_compare
ipv4_is_in_range
ipv4_is_in_any_range
ipv4_is_match
ipv4_is_private
ipv4_netmask_suffix
ipv6_compare
ipv6_is_in_any_range
ipv6_is_in_range
ipv6_is_match
parse_ipv4
parse_ipv4_mask
Mathematical functions
Overview
abs
acos
asin
atan
atan2
cos
cot
degrees
exp
exp2
exp10
gamma
isfinite
isinf
isint
isnan
log
log2
log10
loggamma
max_of
min_of
not
pi
pow
radians
rand
range
round
set_difference
set_has_element
set_intersect
set_union
sign
sin
sqrt
tan
Metadata functions
Overview
column_ifexists
cursor_current
ingestion_time
Pair functions
Overview
find_pair
pair
parse_pair
Rounding functions
Overview
bin
bin_auto
ceiling
floor
String functions
Overview
base64_decode_toarray
base64_decode_tostring
base64_encode_fromarray
base64_encode_tostring
coalesce
countof
countof_regex
extract
extract_all
format_bytes
format_url
gettype
indexof
indexof_regex
isascii
isempty
isnotempty
isnotnull
isnull
parse_bytes
parse_csv
parse_json
parse_path
parse_url
parse_urlquery
quote
regex_quote
replace
replace_regex
replace_string
reverse
split
strcat
strcat_delim
strcmp
string_size
strlen
strrep
strip_ansi_escapes
substring
tolower
totitle
toupper
translate
trim
trim_end
trim_end_regex
trim_regex
trim_space
trim_start
trim_start_regex
unicode_codepoints_from_string
unicode_codepoints_to_string
url_decode
url_encode
SQL functions
Overview
parse_sql
format_sql
Time series functions
Overview
series_abs
series_acos
series_add
series_asin
series_atan
series_ceiling
series_cos
series_cosine_similarity
series_divide
series_dot_product
series_equals
series_exp
series_fft
series_fill_backward
series_fill_const
series_fill_forward
series_fill_linear
series_fir
series_floor
series_greater
series_greater_equals
series_ifft
series_iir
series_less
series_less_equals
series_log
series_magnitude
series_max
series_min
series_multiply
series_not_equals
series_pearson_correlation
series_pow
series_sign
series_sin
series_stats
series_stats_dynamic
series_subtract
series_sum
series_tan
Type functions
Overview
isimei
ismap
isreal
iscc
isstring
isutf8
Aggregation functions
Overview
arg_min
arg_max
avg
avgif
count
countif
dcount
dcountif
histogram
histogramif
make_list
make_list_if
make_set
make_set_if
max
maxif
min
minif
percentile
percentileif
percentiles_array
percentiles_arrayif
phrases
rate
spotlight
stdev
stdevif
sum
sumif
topk
topkif
variance
varianceif
Operators
Tabular operators
Overview
count
distinct
extend
extend-valid
externaldata
getschema
join
limit
lookup
make-series
mv-expand
order
parse
parse-kv
parse-where
project
project-away
project-keep
project-rename
project-reorder
redact
sample
search
sort
summarize
take
top
union
where
Scalar operators
Set membership operators
Overview
in
!in
in~
!in~
Logical
Numerical
String
Reference
Entity names
Map fields
Null values
Scalar data types
Set statement
Special field attributes
Migrate
Splunk SPL
SQL
Sumo Logic

MPL

Language featuresHistograms and summariesSample queriesMigrate
APL

Sample queries

Explore how to use APL in Axiom run queries using tabular operators, scalar functions, and aggregation functions.

This page shows you how to query your data using APL through a wide range of sample queries. You can try out each example in the Axiom Playground.

For an introduction to APL and to the structure of an APL query, see Introduction to APL.

Summarize data

summarize produces a table that aggregates the content of the dataset. Use the aggregation functions with the summarize operator to produce different fields.

The following query counts events by time bins.

APLRun in Playground
['sample-http-logs']
| summarize count() by bin_auto(_time)

The example below summarizes the top 10 GitHub push events by maximum push ID.

APLRun in Playground
['github-push-event']
| summarize max_if = maxif(push_id, true) by size
| top 10 by max_if desc

The example below summarizes the distinct city count by server datacenter.

APLRun in Playground
['sample-http-logs']
| summarize cities = dcount(['geo.city']) by server_datacenter

Tabular operators

where

where filters the content of the dataset that meets a condition when executed.

The following query filters the data by method and content_type:

APLRun in Playground
['sample-http-logs']
| where method == "GET" and content_type == "application/octet-stream"
| project method , content_type

count

count returns the number of events from the input dataset.

APLRun in Playground
['sample-http-logs']
| count

project

project selects a subset of fields.

APLRun in Playground
['sample-http-logs']
| project content_type, ['geo.country'], method, resp_body_size_bytes, resp_header_size_bytes

take

take returns up to the specified number of rows.

APLRun in Playground
['sample-http-logs']
| take 100

limit

The limit operator is an alias to the take operator.

APLRun in Playground
['sample-http-logs']
| limit 10

Scalar functions

parse_json

parse_json extracts the JSON elements from an array.

APLRun in Playground
['sample-http-logs']
| project parsed_json = parse_json( "config_jsonified_metrics")

replace_string

replace_string replaces all string matches with another string.

APLRun in Playground
['sample-http-logs']
| extend replaced_string = replace_string( "creator", "method", "machala" )
| project replaced_string

split

split splits a given string according to a given delimiter and returns a string array.

APLRun in Playground
['sample-http-logs']
| project split_str = split("method_content_metrics", "_")
| take 20

strcat_delim

strcat_delim concatenates a string array into a string with a given delimiter.

APLRun in Playground
['sample-http-logs']
| project strcat = strcat_delim(":", ['geo.city'], resp_body_size_bytes)

indexof

indexof reports the zero-based index of the first occurrence of a specified string within the input string.

APLRun in Playground
['sample-http-logs']
| extend based_index =  indexof( ['geo.country'], content_type, 45, 60, resp_body_size_bytes ), specified_time = bin(resp_header_size_bytes, 30)

Regex examples

Remove leading characters

APLRun in Playground
['sample-http-logs']
| project remove_cutset = trim_start_regex("[^a-zA-Z]", content_type )

Find logs from a city

APLRun in Playground
['sample-http-logs']
| where tostring(geo.city) matches regex "^Camaquã$"

Identify logs from a user agent

APLRun in Playground
['sample-http-logs']
| where tostring(user_agent) matches regex "Mozilla/5.0"

Find logs with response body size in a certain range

APLRun in Playground
['sample-http-logs']
| where toint(resp_body_size_bytes) >= 4000 and toint(resp_body_size_bytes) <= 5000

Find logs with user agents containing Windows NT

APLRun in Playground
['sample-http-logs']
| where tostring(user_agent) matches regex @"Windows NT [\d\.]+"

Find logs with specific response header size

APLRun in Playground
['sample-http-logs']
| where toint(resp_header_size_bytes) == 31

Find logs with specific request duration

APLRun in Playground
['sample-http-logs']
| where toreal(req_duration_ms) < 1

Find logs where TLS is enabled and method is POST

APLRun in Playground
['sample-http-logs']
| where tostring(is_tls) == "true" and tostring(method) == "POST"

Array functions

array_concat

array_concat concatenates a number of dynamic arrays to a single array.

APLRun in Playground
['sample-http-logs']
| extend concatenate = array_concat( dynamic([5,4,3,87,45,2,3,45]))
| project concatenate

array_sum

array_sum calculates the sum of elements in a dynamic array.

APLRun in Playground
['sample-http-logs']
| extend summary_array=dynamic([1,2,3,4])
| project summary_array=array_sum(summary_array)

Conversion functions

todatetime

todatetime converts input to datetime scalar.

APLRun in Playground
['sample-http-logs']
| extend dated_time = todatetime("2026-08-16")

dynamic_to_json

dynamic_to_json converts a scalar value of type dynamic to a canonical string representation.

APLRun in Playground
['sample-http-logs']
| extend dynamic_string = dynamic_to_json(dynamic([10,20,30,40 ]))

Scalar operators

APL supports a wide range of scalar operators:

  • String operators
  • Logical operators
  • Numerical operators

contains

The query below uses the contains operator to find the strings that contain the string -bot and [bot]:

APLRun in Playground
['github-issue-comment-event']
| extend bot = actor contains "-bot" or actor contains "[bot]"
| where bot == true
| summarize count() by bin_auto(_time), actor
| take 20
APLRun in Playground
['sample-http-logs']
| extend user_status = status contains "200" , agent_flow = user_agent contains "(Windows NT 6.4; AppleWebKit/537.36 Chrome/41.0.2225.0 Safari/537.36"
| where user_status == true
| summarize count() by bin_auto(_time), status
| take 15

Hash functions

  • hash_md5 returns an MD5 hash value for the input value.
  • hash_sha256 returns a sha256 hash value for the input value.
  • hash_sha1 returns a sha1 hash value for the input value.
APLRun in Playground
['sample-http-logs']
| extend sha_256 = hash_md5( "resp_header_size_bytes" ), sha_1 = hash_sha1( content_type), md5 = hash_md5( method), sha512 = hash_sha512( "resp_header_size_bytes" )
| project sha_256, sha_1, md5, sha512

Rounding functions

  • floor() calculates the largest integer less than, or equal to, the specified numeric expression.
  • ceiling() calculates the smallest integer greater than, or equal to, the specified numeric expression.
  • bin() rounds values down to an integer multiple of a given bin size.
APLRun in Playground
['sample-http-logs']
| extend largest_integer_less = floor( resp_header_size_bytes ), smallest_integer_greater = ceiling( req_duration_ms ), integer_multiple = bin( resp_body_size_bytes, 5 )
| project largest_integer_less, smallest_integer_greater, integer_multiple

Truncate decimals using round function

APLRun in Playground
['sample-http-logs']
| project rounded_value = round(req_duration_ms, 2)

Truncate decimals using floor function

APLRun in Playground
['sample-http-logs']
| project floor_value = floor(resp_body_size_bytes), ceiling_value = ceiling(req_duration_ms)

Other examples

List all unique groups

APLRun in Playground
['sample-http-logs']
| distinct ['id'], is_tls

Count of all events per service

APLRun in Playground
['sample-http-logs']
| summarize Count = count() by server_datacenter
| order by Count desc

Change the time clause

APLRun in Playground
['github-issues-event']
| where _time == ago(1m)
| summarize count(), sum(['milestone.number']) by _time=bin(_time, 1m)

HTTP 5xx responses for the last 7 days, one bar per day

APLRun in Playground
['sample-http-logs']
| where _time > ago(7d)
| where req_duration_ms >= 5 and req_duration_ms < 6
| summarize count(), histogram(resp_header_size_bytes, 20) by bin(_time, 1d)
| order by _time desc

Implement a remapper on remote address logs

APLRun in Playground
['sample-http-logs']
| extend RemappedStatus = case(req_duration_ms >= 0.57, "new data", resp_body_size_bytes >= 1000, "size bytes", resp_header_size_bytes == 40, "header values", "doesntmatch")

Advanced aggregations

APLRun in Playground
['sample-http-logs']
| extend prospect = ['geo.city'] contains "Okayama" or uri contains "/api/v1/messages/back"
| extend possibility = server_datacenter contains "GRU" or status contains "301"
| summarize count(), topk( user_agent, 6 ) by bin(_time, 10d), ['geo.country']
| take 4

Search map fields

APLRun in Playground
['otel-demo-traces']
| where isnotnull( ['attributes.custom'])
| extend extra = tostring(['attributes.custom'])
| search extra:"0PUK6V6EV0"
| project _time, trace_id, name, ['attributes.custom']

Configure processing rules

APLRun in Playground
['sample-http-logs']
| where _sysTime > ago(1d)
| summarize count() by method

Return different values based on the evaluation of a condition

APLRun in Playground
['sample-http-logs']
| extend MemoryUsageStatus = iff(req_duration_ms > 10000, "Highest", "Normal")

Working with different operators

APLRun in Playground
['hn']
| extend superman = text contains "superman" or title contains "superman"
| extend batman = text contains "batman" or title contains "batman"
| extend hero = case(
    superman and batman, "both",
    superman, "superman   ", // spaces change the color
    batman, "batman       ",
    "none")
| where (superman or batman) and not (batman and superman)
| summarize count(), topk(type, 3) by bin(_time, 30d), hero
| take 10
APLRun in Playground
['sample-http-logs']
| summarize flow = dcount( content_type) by ['geo.country']
| take 50

Get the JSON into a property bag using parse-json

APL
example
| where isnotnull(log)
| extend parsed_log = parse_json(log)
| project service, parsed_log.level, parsed_log.message

Get average response using project-keep

APLRun in Playground
['sample-http-logs']
| where ['geo.country']  == "United States" or ['id'] == 'b2b1f597-0385-4fed-a911-140facb757ef'
| extend systematic_view = ceiling( resp_header_size_bytes )
| extend resp_avg = cos( resp_body_size_bytes )
| project-away systematic_view
| project-keep resp_avg
| take 5

Combine multiple percentiles into a single chart

APLRun in Playground
['sample-http-logs']
| summarize percentiles_array(req_duration_ms, 50, 75, 90) by bin_auto(_time)

Combine mathematical functions

APLRun in Playground
['sample-http-logs']
| extend tangent = tan( req_duration_ms ), cosine = cos( resp_header_size_bytes ), absolute_input = abs( req_duration_ms ), sine = sin( resp_header_size_bytes ), power_factor = pow( req_duration_ms, 4)
| extend angle_pi = degrees( resp_body_size_bytes ), pie = pi()
| project tangent, cosine, absolute_input, angle_pi, pie, sine, power_factor
APLRun in Playground
['github-issues-event']
| where actor !endswith "[bot]"
| where repo startswith "kubernetes/"
| where action == "opened"
| summarize count() by bin_auto(_time)

Change global configuration attributes

APLRun in Playground
['sample-http-logs']
| extend status = coalesce(status, "info")

Set defualt value on event field

APLRun in Playground
['sample-http-logs']
| project status = case(
    isnotnull(status) and status != "", content_type, // use the contenttype if it’s not null and not an empty string
    "info" // default value
  )

Extract nested payment amount from custom attributes map field

APLRun in Playground
['otel-demo-traces']
| extend amount = ['attributes.custom']['app.payment.amount']
| where isnotnull( amount)
| project _time, trace_id, name, amount, ['attributes.custom']

Filtering GitHub issues by label identifier

APLRun in Playground
['github-issues-event']
| extend data = tostring(labels)
| where labels contains "d73a4a"

Aggregate trace counts by HTTP method attribute in custom map

APLRun in Playground
['otel-demo-traces']
| extend httpFlavor = tostring(['attributes.custom'])
| summarize Count=count() by ['attributes.http.method']
Was this page helpful?
Suggest edits on GitHub
PreviousAxiom Processing Language (APL)NextAll features of Axiom Processing Language (APL)
On this page
Summarize dataTabular operatorswherecountprojecttakelimitScalar functionsparse_jsonreplace_stringsplitstrcat_delimindexofRegex examplesArray functionsarray_concatarray_sumConversion functionstodatetimedynamic_to_jsonScalar operatorscontainsHash functionsRounding functionsOther examples