Sample queries
Explore how to use APL in Axiom’s Query tab to 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.
The example below summarizes the top 10 GitHub push events by maximum push ID.
The example below summarizes the distinct city count 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
:
count
count returns the number of events from the input dataset.
project
project selects a subset of columns.
take
take returns up to the specified number of rows.
limit
The limit
operator is an alias to the take
operator.
Scalar functions
parse_json
parse_json extracts the JSON elements from an array.
replace_string
replace_string replaces all string matches with another string.
split
split splits a given string according to a given delimiter and returns a string array.
strcat_delim
strcat_delim concatenates a string array into a string with a given delimiter.
indexof
indexof reports the zero-based index of the first occurrence of a specified string within the input string.
Regex examples
Remove leading characters
Find logs from a city
Identify logs from a user agent
Find logs with response body size in a certain range
Find logs with user agents containing Windows NT
Find logs with specific response header size
Find logs with specific request duration
Find logs where TLS is enabled and method is POST
Array functions
array_concat
array_concat concatenates a number of dynamic arrays to a single array.
array_sum
array_sum calculates the sum of elements in a dynamic array.
Conversion functions
todatetime
todatetime converts input to datetime scalar.
dynamic_to_json
dynamic_to_json converts a scalar value of type dynamic to a canonical string representation.
Scalar operators
APL supports a wide range of scalar operators:
contains
The query below uses the contains
operator to find the strings that contain the string -bot
and [bot]
:
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.
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.
Truncate decimals using round function
Truncate decimals using floor function
Other examples
List all unique groups
Count of all events per service
Change the time clause
HTTP 5xx responses for the last 7 days, one bar per day
Implement a remapper on remote address logs
Advanced aggregations
Search map fields
Configure processing rules
Return different values based on the evaluation of a condition
Working with different operators
Get the JSON into a property bag using parse-json
Get average response using project-keep
Combine multiple percentiles into a single chart
Combine mathematical functions
Change global configuration attributes
Set defualt value on event field
Extract nested payment amount from custom attributes map field
Filtering GitHub issues by label identifier
Aggregate trace counts by HTTP method attribute in custom map