Getting Data In

Index only one column from csv input

vinaykata
Path Finder

I wanted to index only "Date" column from this CSV file. I don't want any of the other columns to be indexed and want to skip the first row before indexing. This is a continuous monitoring file. Is there any possible way to extract a single column from CSV input file?

Tags (1)
0 Karma

maciep
Champion

I think you could add some parsing config on your indexer to handle this. First, you could call transforms to remove the header row (assuming that's the first row you don't want) and then SEDCMD to replace the first comma and the rest of the event with nothing.

Something like this maybe (tried match both of the non-data rows in sample for discard). This not tested so may but hopefully not too many typos..

props.conf

[your_sourcetype]
TIMESTAMP_FORMAT = %m/%d/%Y
SHOULD_LINEMERGE = false
TRANSFORMS-drop_header = drop_header
SEDCMD-keep_first_row = s/^([^,]+).+/\1/g

transforms.conf

[drop_header]
REGEX = ^(Date|Report)
DEST_KEY = queue
FORMAT = nullQueue
0 Karma
Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...