Skip to main content
In this tutorial, you’ll explore how to use APL in Axiom’s Query tab to run queries using Tabular Operators, Scalar Functions, and Aggregation Functions.

Prerequisites

Overview of APL

Every query, starts with a dataset embedded in square brackets, with the starting expression being a tabular operator statement. The query’s tabular expression statements produce the results of the query. Before you can start writing tabular operators or any function, the pipe (|) delimiter starts the query statements as they flow from one function to another.

Commonly used Operators

To run queries on each function or operator in this tutorial, click the Run in Playground button. summarize: Produces a table that aggregates the content of the dataset. The following query returns the count of events by time
Run in Playground You can use the aggregation functions with the summarize operator to produce different columns.

Top 10 GitHub push events by maximum push id

Run in Playground

Distinct City count by server datacenter

Run in Playground The result of a summarize operation has:
  • A row for every combination of by values
  • Each column named in by
  • A column for each expression
where: Filters the content of the dataset that meets a condition when executed. The following query filters the data by method and content_type:
Run in Playground count: Returns the number of events from the input dataset.
Run in Playground Summarize count by time bins in sample HTTP logs
Run in Playground project: Selects a subset of columns.
Run in Playground take: Returns up to the specified number of rows.
Run in Playground The limit operator is an alias to the take operator.
Run in Playground

Scalar Functions

parse_json()

The following query extracts the JSON elements from an array:
Run in Playground

replace_string(): Replaces all string matches with another string.

Run in Playground

split(): Splits a given string according to a given delimiter and returns a string array.

Run in Playground

strcat_delim(): Concatenates a string array into a string with a given delimiter.

Run in Playground

indexof(): Reports the zero-based index of the first occurrence of a specified string within the input string.

Run in Playground

Regex Examples

Run in Playground

Finding logs from a specific City

Run in Playground

Identifying logs from a specific user agent

Run in Playground

Finding logs with response body size in a certain range

Run in Playground

Finding logs with user agents containing Windows NT

Run in Playground

Finding logs with specific response header size

Run in Playground

Finding logs with specific request duration

Run in Playground

Finding logs where TLS is enabled and method is POST

Run in Playground

Array functions

array_concat(): Concatenates a number of dynamic arrays to a single array.

Run in Playground

array_sum(): Calculates the sum of elements in a dynamic array.

Run in Playground

Conversion functions

todatetime(): Converts input to datetime scalar.

Run in Playground

dynamic_to_json(): Converts a scalar value of type dynamic to a canonical string representation.

Run in Playground

String Operators

We support various query string, logical and numerical operators. In the query below, we use the contains operator, to find the strings that contain the string -bot and [bot]:
Run in Playground
Run in Playground

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.
Run in Playground

List all unique groups

Run in Playground

Count of all events per service

Run in Playground

Change the time clause

Run in Playground

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.
Run in Playground

Truncate decimals using round function

Run in Playground

Truncate decimals using floor function

Run in Playground

HTTP 5xx responses (day wise) for the last 7 days - one bar per day

Run in Playground

Implement a remapper on remote address logs

Run in Playground

Advanced aggregations

In this section, you will learn how to run queries using different functions and operators.
Run in Playground

Searching map fields

Run in Playground

Configure Processing rules

Run in Playground

Return different values based on the evaluation of a condition

Run in Playground

Working with different operators

Run in Playground
Run in Playground

Get the JSON into a property bag using parse-json

Get average response using project keep function

Run in Playground

Combine multiple percentiles into a single chart in APL

Run in Playground

Combine mathematical functions

Run in Playground
Run in Playground

Change global configuration attributes

Run in Playground

Set defualt value on event field

Run in Playground

Extract nested payment amount from custom attributes map field

Run in Playground

Filtering GitHub issues by label identifier

Run in Playground

Aggregate trace counts by HTTP method attribute in custom map

Run in Playground