split
This page explains how to use the split function in APL.
The split function splits a string into an array of substrings based on a delimiter. Use this function to tokenize log messages, parse delimited data, or break down structured text into individual components for analysis.
Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| source | string | Yes | The source string to split. |
| delimiter | string | Yes | The delimiter string to split on. |
Returns
Returns a string array containing the substrings separated by the delimiter.
Use case examples
Split URI paths into segments for hierarchical analysis of API endpoint structure.
Query
Output
| first_segment | segment_count | request_count |
|---|---|---|
| api | 4 | 5432 |
| users | 3 | 2341 |
| products | 3 | 1987 |
This query splits URIs by forward slashes to analyze API endpoint hierarchy and identify the most accessed top-level paths.
Parse dot-notation service names into components for hierarchical analysis.
Query
Output
| service_type | part_count | span_count |
|---|---|---|
| frontend | 1 | 4532 |
| checkout | 1 | 3421 |
| cart | 1 | 2987 |
This query splits service names by hyphens to extract service type prefixes and analyze service naming patterns.
Parse comma-separated attack indicators from security headers or URIs.
Query
Output
| _time | uri | threat_list | threat_count | has_multiple_threats | id | status |
|---|---|---|---|---|---|---|
| 2024-11-06T10:00:00Z | /admin | ["sql_injection","xss","path_traversal"] | 3 | true | user123 | 403 |
This query splits comma-separated threat indicators to analyze the types and combinations of security threats.
List of related functions
- parse_csv: Parses CSV strings with proper quote handling. Use this for CSV data instead of split.
- extract_all: Extracts multiple regex matches. Use this when you need pattern-based tokenization.
- strcat_delim: Concatenates strings with delimiters. Use this to reverse the split operation.
- indexof: Finds delimiter positions. Use this when you need to know where splits would occur.