Dashboards & Visualizations

CSV Field Extraction

teco_akelly
Engager

I've got a non-standard CSV log file that has no headers. Depending on the first field of each line determines what number and order of the fields are behind it. How can I have splunk assign field names to the data depending on the first field in a given row?

An example would be:

Operation Record,Timestamp,Tagname,Decription,Station

Alarm Confirm,Timestamp,Tagname,Station,Severity,

Process Alarm,Timestamp,Tagname,Description,Value

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Many of us like regex101.com for help writing and testing regular expressions.

I think you'll need a transform for each type of records in the CSV file.  The transforms would look something like this.

[parseOperation]
REGEX = Operation Record,([^,]+),([^,]+),([^,]+),([^,]+)
FORMAT = Timestamp::$1 Tagname::$2 Description::$3 Station::$4

[parseAlarm]
REGEX = Alarm Confirm,([^,]+),([^,]+),([^,]+),([^,]+)
FORMAT = Timestamp::$1 Tagname::$2 Station::$3 Severity::$4

[parseProcess]
REGEX = Process Alarm,([^,]+),([^,]+),([^,]+),([^,]+)
FORMAT = Timestamp::$1 Tagname::$2 Description::$3 Value::$4

Then a props.conf attribute would reference the transforms.

[mysourcetype]
TRANSFORMS-parsers = parseOperation, parseAlarm, parseProcess

See the Admin Manual for more information about transforms.

---
If this reply helps you, Karma would be appreciated.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

That's not a true CSV file, even though the values are separated by commas.

I would try using transforms with REGEX to parse those rows.

---
If this reply helps you, Karma would be appreciated.
0 Karma

teco_akelly
Engager

Do you know if there are any tools out there or someone I can get to assist in writing this if I provide the csv? I am completely unfamiliar with transforms and REGEX.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...