SPL provides instructions for field operations, data extraction, filtering, aggregation, and data transformation. Each instruction supports specific processing scenarios such as data transformation, Ingest Processor, Consumer Processor, scan mode, and Logtail collection.
Parameter types
SPL instructions use the following parameter types.
|
Parameter type |
Description |
|
Bool |
A Boolean parameter that acts as a switch in SPL. |
|
Char |
An ASCII character parameter, enclosed in single quotation marks (''). Examples: |
|
Integer |
An integer parameter. |
|
String |
A string parameter, enclosed in single quotation marks (''). Example: |
|
RegExp |
An RE2 regular expression parameter, enclosed in single quotation marks (''). Example: RE2 syntax details: Syntax. |
|
JSONPath |
A JSON path parameter, enclosed in single quotation marks (''). Example: JSONPath syntax details: JsonPath. |
|
Field |
A field name parameter. Example: Enclose field names that contain special characters (other than letters, digits, and underscores) in double quotation marks (""). Example: Note
Field name case sensitivity rules are documented in General reference. |
|
FieldPattern |
A field name or wildcard pattern. The wildcard (*) matches zero or more characters. Enclose patterns in double quotation marks (""). Example: Note
Field name case sensitivity rules are documented in General reference. |
|
SPLExp |
An SPL expression parameter. |
|
SQLExp |
An SQL expression parameter. |
SPL instruction list
|
Instruction category |
Instruction name |
Description |
Data transformation |
Ingest Processor |
Consumer Processor |
Scan mode (SCAN) |
Logtail collection |
|
Control instruction |
Defines a named dataset. SPL dataset details are covered in General reference. |
Yes |
× |
× |
√ |
× |
|
|
Field operation instruction |
Retains fields matching a specified pattern and renames specified fields. Field retention expressions are processed before renaming expressions. |
Supported |
Supported |
Supported |
Supported |
Supported |
|
|
Removes fields that match a specified pattern and retains all other fields. |
Supported |
Supported |
Supported |
Supported |
✓ |
||
|
Renames specified fields and retains all other fields. |
Supported |
Supported |
Supported |
Supported |
Supported |
||
|
Expands the top-level JSON object of a specified field into multiple results. |
Supported |
× |
Supported |
Unsupported |
× |
||
|
SQL calculation instruction for structured data |
Creates new fields from SQL expression results. Supported SQL functions are listed in List of SQL functions supported by SPL. |
Supported |
Supported |
Supported |
Supported |
Supported |
|
|
Filters data by an SQL expression and retains matching entries. Supported SQL functions are listed in List of SQL functions supported by SPL. |
Supported |
✓ |
Supported |
Supported |
Supported |
||
|
Semi-structured data extraction instruction |
Extracts information matching regular expression groups from a specified field. |
√ |
√ |
Supported |
✓ |
Supported |
|
|
Extracts information in CSV format from a specified field. |
√ |
Supported |
Supported |
√ |
Supported |
||
|
Extracts top-level JSON fields from a specified field. |
Supported |
Supported |
√ |
√ |
Supported |
||
|
Extracts key-value pair information from a specified field. |
Supported |
Supported |
Supported |
Supported |
Supported |
||
|
New data transformation instruction |
Packs log fields into a new field through JSON serialization. Suitable for structured transmission scenarios such as building API request bodies. |
✓ |
× |
✓ |
Supported |
× |
|
|
Converts log format to time series storage format. |
Supported |
× |
× |
× |
× |
||
|
Processes existing metric data, such as adding, modifying, or removing tags. |
Supported |
× |
× |
× |
× |
||
|
Aggregation instruction |
Performs statistical analysis on log fields, similar to SQL aggregate functions such as |
× |
× |
Unsupported |
Supported |
× |
|
|
Sorts query results by field values or statistical results in ascending ( |
× |
× |
× |
Supported |
× |
||
|
Limits the number of log rows returned in query results. Use |
× |
× |
× |
Supported |
× |
Function overview
SPL instructions support most SQL functions. Availability and applicable scenarios for each function are described in their respective documentation.
|
Category |
Description |
Common functions |
|
Computes a single result from a set of input values. |
||
|
Finds, replaces, extracts, concatenates, and formats text data. |
||
|
Converts, truncates, and aggregates date and time values. |
||
|
Extracts, transforms, and queries data from JSON objects and arrays. |
||
|
Matches, extracts, and replaces text using regular expressions. |
||
|
Compares time-series data across different time periods. |
||
|
Accesses, filters, and transforms array elements. |
||
|
Operates on key-value pairs (maps). |
||
|
Rounds, generates random numbers, and performs trigonometric calculations. |
||
|
Analyzes data distributions with correlation, regression, and probability functions. |
||
|
Converts values from one data type to another. |
||
|
Computes aggregations or rankings over a sliding window of rows. |
||
|
Parses and processes IP addresses. |
||
|
Extracts components from URLs. |
||
|
Approximates distinct counts, percentiles, and histograms for large datasets. |
||
|
Operates on binary data. |
||
|
Performs bitwise operations on integers. |
||
|
Operates on spatial geometry objects. |
||
|
Performs geospatial analysis and calculations. |
||
|
Creates and manipulates color representations. |
||
|
Estimates cardinality on large datasets with minimal memory. |
||
|
Compares values across types (double, bigint, varchar, timestamp, date) and returns a boolean. |
||
|
Combines multiple boolean expressions to control logical flow. |
||
|
Converts data sizes or time intervals between different units. |
||
|
Tracks sequential user actions for conversion funnel analysis. |
||
|
Defines inline functions for higher-order array operations in SQL or SPL. |
||
|
Returns different values based on a specified condition. |