Edge Delta Parse CSV Processor

The Edge Delta parse CSV processor parses CSV data fields into structured data.

The Parse CSV processor parses a CSV row field and a header field into an array of fields. The processor performs a conditional transformation based on whether the attributes field is a map or not. If attributes is already a map, the processor will merge the parsed body into it. If it’s not a map, the processor will replace it completely with the parsed body.

For detailed instructions on how to use multiprocessors, see Use Multiprocessors.

Configuration

Consider this log:

{
  "_type": "log",
  "timestamp": 1745295299953,
  "body": "{\"csv\": \"XYZ789,user2,logout,failure\", \"csv_headers\": \"Session_ID,User_ID,Event_Type,Event_Details\"}",
  "resource": {
...
  },
  "attributes": {
    "csv": "XYZ789,user2,logout,failure",
    "csv_headers": "Session_ID,User_ID,Event_Type,Event_Details"
  }
}

The following configuration parses the attribute fields for the header and csv rows into a structured object:

This is the YAML version:

- name: Multi Processor_fa8d
  type: sequence
  processors:
  - type: ottl_transform
    metadata: '{"id":"a056ZYQrDcwFT1iLvwZWk","type":"parse-csv","name":"Parse CSV"}'
    statements: |-
      merge_maps(attributes["parsed"], ParseCSV(attributes["csv"], attributes["csv_headers"], ",", ",", "lazyQuotes"), "upsert") where IsMap(attributes["parsed"])
      set(attributes["parsed"], ParseCSV(attributes["csv"], attributes["csv_headers"], ",", ",", "lazyQuotes")) where not IsMap(attributes["parsed"])      

The resulting log now contains the parsed attribute:

{
  "_type": "log",
  "timestamp": 1745295299953,
  "body": "{\"csv\": \"XYZ789,user2,logout,failure\", \"csv_headers\": \"Session_ID,User_ID,Event_Type,Event_Details\"}",
  "resource": {
...
  },
  "attributes": {
    "csv": "XYZ789,user2,logout,failure",
    "csv_headers": "Session_ID,User_ID,Event_Type,Event_Details",
    "parsed": {
      "Event_Details": "failure",
      "Event_Type": "logout",
      "Session_ID": "XYZ789",
      "User_ID": "user2"
    }
  }
}

Options

Select a telemetry type

You can specify, log, metric, trace or all. It is specified using the interface, which generates a YAML list item for you under the data_types parameter. This defines the data item types against which the processor must operate. If data_types is not specified, the default value is all. It is optional.

It is defined in YAML as follows:

- name: multiprocessor
  type: sequence
  processors:
  - type: <processor type>
    data_types:
    - log

condition

The condition parameter contains a conditional phrase of an OTTL statement. It restricts operation of the processor to only data items where the condition is met. Those data items that do not match the condition are passed without processing. You configure it in the interface and an OTTL condition is generated. It is optional. You can select one of the following operators:

Operator Name Description Example
== Equal to Returns true if both values are exactly the same attributes["status"] == "OK"
!= Not equal to Returns true if the values are not the same attributes["level"] != "debug"
> Greater than Returns true if the left value is greater than the right attributes["duration_ms"] > 1000
>= Greater than or equal Returns true if the left value is greater than or equal to the right attributes["score"] >= 90
< Less than Returns true if the left value is less than the right attributes["load"] < 0.75
<= Less than or equal Returns true if the left value is less than or equal to the right attributes["retries"] <= 3
matches Regex match Returns true if the string matches a regular expression isMatch(attributes["name"], ".*\\.name$"

It is defined in YAML as follows:

- name: _multiprocessor
  type: sequence
  processors:
  - type: <processor type>
    condition: attributes["request"]["path"] == "/json/view"

Parse from

Specify the field containing the CSV data.

Assign to

Specify the field where you want the parsed object to be saved.

Header source

Choose between defining the headers in the configuration (Static string) or specifying a field in the data item that contains the headers (Path).

Specify the field containing the headers if Path is selected as the Header source. Otherwise specify the Headers separated by a comma.

Delimiter

You can specify which character is used in the source data item to separate the CSV values. It uses a comma by default.

Header Delimiter

You can specify which character is used in the source data item to separate the Header values. It uses a comma by default.

Mode

The mode option sets how strictly to interpret the CSV fields. You can choose from one of the following:

Option Description
Strict Enforces proper CSV format with matching quotes.
Lazy quotes Allows malformed or mismatched quotes, parses leniently.
Ignore quotes Treats quotes as normal characters, no special parsing.

Final

The final parameter specifies whether successfully processed data items should continue to subsequent processors within the same multiprocessor node. Data items that fail to be processed by the processor will be passed to the next processor in the node regardless of this setting. You select the slider in the tool which specifies it for you in the YAML as a Boolean. The default is false and it is optional.

It is defined in YAML as follows:

- name: multiprocessor
  type: sequence
  processors:
    - type: <processor type>
    final: true

Keep original telemetry item

This option defines whether to delete the original unmodified data item after it is processed. For example, you can keep the original log as well as any metrics generated by an extract metric processor. If you select this option your data volume will increase.