inputcsv
inputcsv
Synopsis
Loads search results from the specified csv file.
Syntax
inputcsv [append=<bool>] [start=<int>] [max=<int>] [events=<bool>] <filename>
Required arguments
- filename
- Syntax: <filename>
- Description: Specify the name of the CSV file, located in
$SPLUNK_HOME/var/run/splunk.
Optional arguments
- append
- Syntax: append=<bool>
- Description: Specifies whether the data from the CSV file is appended to the current set of results (true) or replaces the current set of results (false). Defaults to false.
- events
- Syntax: events=<bool>
- Description: Allows the imported results to be treated as events so that a proper timeline and fields picker are displayed.
- max
- Syntax: max=<int>
- Description: Controls the maximum number of events to be read from the file. Defaults to 1000000000.
- start
- Syntax: start=<int>
- Description: Controls the 0-based offset of the first event to be read. Defaults to 0.
Description
Populates the results data structure using the given csv file, which is not modified. The filename must refer to a relative path in $SPLUNK_HOME/var/run/splunk and if the specified file does not exist and the filename did not have an extension, then filename with a .csv extension is assumed.
Note: If you run into an issue with inputcsv resulting in an error, make sure that your CSV file ends with a BLANK LINE.
Examples
Example 1: Read in results from the CSV file: "$SPLUNK_HOME/var/run/splunk/all.csv", keep any that contain the string "error", and save the results to the file: "$SPLUNK_HOME/var/run/splunk/error.csv"
| inputcsv all.csv | search error | outputcsv errors.csvExample 2: Read in events 101 to 600 from either file 'bar' (if exists) or 'bar.csv'.
| inputcsv start=100 max=500 barExample 3: Read in events from the CSV file: "$SPLUNK_HOME/var/run/splunk/foo.csv".
| inputcsv foo.csvSee also
Answers
Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the inputcsv command.
This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 , 4.2 , 4.2.1 , 4.2.2 , 4.2.3 , 4.2.4 , 4.2.5 , 4.3 , 4.3.1 , 4.3.2 View the Article History for its revisions.