Skip to main content
The parse_csv function splits a comma-separated values (CSV) string into an array of strings. Use this function to parse CSV-formatted log entries, configuration values, or any comma-delimited data into individual values for analysis.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
In Splunk SPL, you use rex or the split function to parse CSV. APL’s parse_csv provides proper CSV parsing with quote handling.
| makemv delim="," field_name
In ANSI SQL, parsing CSV requires string splitting functions that vary by database. APL’s parse_csv provides standardized CSV parsing.
SELECT STRING_TO_ARRAY(field_name, ',') AS values FROM logs;

Usage

Syntax

parse_csv(csv_text)

Parameters

NameTypeRequiredDescription
csv_textstringYesA string containing comma-separated values to parse.

Returns

Returns a string array containing the individual values from the CSV string. Properly handles quoted values and escaped characters.

Use case examples

  • Log analysis
  • OpenTelemetry traces
  • Security logs
Parse comma-separated status codes or error types from log messages.Query
['sample-http-logs']
| extend status_list = parse_csv('200,201,204,304')
| extend is_success = status in (status_list)
| summarize request_count = count() by is_success, status
| sort by request_count desc
| limit 10
Run in PlaygroundOutput
is_successstatusrequest_count
true2008765
false4042341
false5001234
true304987
This query parses a CSV list of success status codes and categorizes requests accordingly.
  • split: Splits strings by any delimiter. Use this when working with non-CSV delimiters or when quote handling is not needed.
  • parse_json: Parses JSON strings into dynamic objects. Use this when working with JSON arrays rather than CSV.
  • strcat_delim: Concatenates strings with delimiters. Use this to create CSV strings from individual values.
  • extract_all: Extracts multiple regex matches. Use this for more complex parsing patterns beyond CSV.