Getting Data In

Input multiple csv files

darioapis
Explorer

Hi, I am trying to load multiple csv files to my search result. I know that can be done using the append command, but I am wonder if it can be done using something like thisinputcsv some*.csv. Thanks

Tags (2)
0 Karma

sbaror11
Explorer

I need to read csv files *dynamically*. That is, every week a new file is added. So every week I need to read an additional file. Is there a way to build an automated dynamic command? 
I can get the list of all files with  rest/servicesNS/-/-/data/lookup-table-files | search title="file*.csv". 
But what's next? 

my current workaround is to build the cmd using the above, and then copying it to the spl line and running it. This is not automatic of course. 

 All the examples above are for a static list of files. 

0 Karma

woodcock
Esteemed Legend

If your files have more thank 50500 lines, other methods may truncate your events due to subsearch limits. The only what that I have found to pull in multiple CSVs without truncation on any version of Splunk is like this:

|inputlookup file1.csv
| appendpipe [ |inputlookup file2.csv ]
| appendpipe [ |inputlookup file3.csv ]
...
| appendpipe [ |inputlookup fileN.csv ]
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There could be many ways to do that, but it depends on your use case and data. More detail would be helpful.

One option: | inputlookup file1.csv | inputlookup append=t file2.csv | ....

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

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 ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...