We have updated our Terms of Service, Code of Conduct, and Addendum.

How to use first line in CSV as the headers for Parser function

So I have a script that will collect data from an API. The data is returns is CSV formatted, the first line will be the list of fields. How do you tell Stream to use that first line as the headers?

Best Answer

  • Brendan Dalpe
    Brendan Dalpe Posts: 201 mod
    Answer ✓

    Hi @rolltidega, Cribl Stream has a default "CSV Ruleset" that will extract the field names based on the CSV header and automatically unroll each line into an individual event.

    Im assuming youre using a scripted collector… you can add the event breaker by opening the scripted collector config and click on Event Breakers on the left side of the config. Add a ruleset and select "CSV Ruleset" from the dropdown.

Answers

  • Brendan Dalpe
    Brendan Dalpe Posts: 201 mod
    Answer ✓

    Hi @rolltidega, Cribl Stream has a default "CSV Ruleset" that will extract the field names based on the CSV header and automatically unroll each line into an individual event.

    Im assuming youre using a scripted collector… you can add the event breaker by opening the scripted collector config and click on Event Breakers on the left side of the config. Add a ruleset and select "CSV Ruleset" from the dropdown.

  • Shawn Cannon
    Shawn Cannon Posts: 131 ✭✭

    Yeah I found that thanks.