Getting Data In

How to omit columns from CSV-style event input?

ziq
Engager

I intend to import a CSV-style file into Splunk. The file has about 30 columns, about 120 million lines and is about 150GB of size. Of the file, I only require a subset of columns.

The file's contents shall be imported as events and not as a CSV lookup file.

For sake of simplicity, assume the structure below:

src,dest_ip,dest_port,dest_user,dest_zone
10.50.60.80,192.0.2.92,443,emily,Internet
10.50.60.53,203.0.113.12,389,brian,Intranet
10.33.118.40,198.51.100.65,80,john,Internet
...

Is there any way to exclude the "dest_user" column from the import?

(Running the data through a sed/awk/perl script beforehand is certainly possible, but given the size of the file this would be computationally expensive. And as Splunk already extracts the field headers, it appears to me that excluding columns from import would be the cleaner and more efficient approach. Furthermore, it is likely that I will have to deal with similar files (that have different fieldsets or column orders) in the future.)

p_gurav
Champion

Hi ziq,

You can use script to create new csv with selected fields and then index into splunk.

0 Karma

ziq
Engager

I'm aware and mentioned the script option in my question. But running the data through a script beforehand would be twice as computationally expensive (or more). I also anticipate similar files with different field sets in the future, hence I would need to touch/modify the script for each of these files.

(Running the data through a
sed/awk/perl script beforehand is
certainly possible, but given the size
of the file this would be
computationally expensive. And as
Splunk already extracts the field
headers, it appears to me that
excluding columns from import would be
the cleaner and more efficient
approach. Furthermore, it is likely
that I will have to deal with similar
files (that have different fieldsets
or column orders) in the future.)

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...