Saves search results to the specified CSV file on the local search-head in the
$SPLUNK_HOME/var/run/splunk directory. Updates to
$SPLUNK_HOME/var/run/*.csv using outputcsv are not replicated across the cluster.
outputcsv [append=<bool>] [create_empty=<bool>] [dispatch=<bool>] [usexml=<bool>] [singlefile=<bool>] [<filename>]
- Syntax: append=<bool>
- Description: If 'append' is true, attempts to append to an existing csv file if it exists or create a file if necessary. If there is an existing file that has a csv header already, only emits the fields that are referenced by that header. .gz files cannot be appended to.
- Default: false
- Syntax: create_empty=<bool>
- Description: If set to true and there are no results, creates a 0-length file. When false, no file is created and if
append=false, the file is deleted if it previously existed.
- Default: false
- Syntax: dispatch=<bool>
- Description: If set to true, refers to a file in the job directory in
- Syntax: <filename>
- Description: Specify the name of a csv file to write the search results. This file should be located in
$SPLUNK_HOME/var/run/splunk. If no filename specified, rewrites the contents of each result as a CSV row into the "_xml" field. Otherwise writes into a file and appends ".csv" to filename if filename has no existing extension.
- Syntax: singlefile=<bool>
- Description: If singlefile is set to true and output spans multiple files, collapses it into a single file.
- Default: true
- Syntax: usexml=<bool>
- Description: If there is no filename, specifies whether or not to encode the CSV output into XML. This option should not specified when invoking the
outputcsvcommand from Splunk Web.
There is no limit to the number of results that can be saved to the CSV file.
Output search results to the CSV file 'mysearch.csv'.
... | outputcsv mysearch
Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the outputcsv command.
This documentation applies to the following versions of Splunk® Enterprise: 5.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.10, 5.0.11, 5.0.12, 5.0.13, 5.0.14