Search Reference

 


outputcsv

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

outputcsv

Synopsis

Outputs search results to the specified csv file.

Syntax

outputcsv [create_empty=<bool>] [dispatch=<bool>] [usexml=<bool>] [singlefile=<bool>] [<filename>]

Optional arguments

create_empty
Syntax: create_empty=<bool>
Descriptopn: If set to true and there are no results, creates a 0-length file. When false, no file is created and the files is deleted if it previously existed. Defaults to false.
dispatch
Syntax: dispatch=<bool>
Description: If set to true, refers to a file in the job directory in $SPLUNK_HOME/var/run/splunk/dispatch/<job id>/.
filename
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 (appends ".csv" to filename if filename has no existing extension).
singlefile
Syntax: singlefile=<bool>
Description: If singlefile is set to true and output spans multiple files, collapses it into a single file.
usexml
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 outputcsv from the UI.

Examples

Example 1: Output search results to the CSV file 'mysearch.csv'.

... | outputcsv mysearch

See also

inputcsv

Answers

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: 4.3 , 4.3.1 , 4.3.2 , 4.3.3 , 4.3.4 , 4.3.5 , 4.3.6 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!