Export data using the CLI
The Command Line Interface (CLI) is easy to script, can handle automation, and can process volumes of data faster and more efficiently than Splunk Web. To access Splunk Enterprise through the CLI, you either need shell access to a Splunk Enterprise server, or permission to access the correct port on a remote Splunk server. If you have Splunk Cloud, you do not have shell access to your Splunk Cloud deployment, so cannot use the CLI to export data.
The syntax for exporting data using the CLI is as follows:
splunk search [eventdata] -preview 0 -maxout 0 -output [rawdata|json|csv|xml] > [myfilename.log] ...
By default, you can export a maximum of 100 events. To increase this number, use the
-maxout argument. For example, if you include
-maxout 300000 you can export 300,000 events. Set
-maxout to 0 to export an unlimited number of events.
To learn more about the Splunk Enterprise CLI, read About the CLI in the Admin Manual.
CLI output command example
This CLI example takes events from the
_internal index that occur within the time range specified by the search string and outputs 200,000 of them in raw data format to the file
splunk search "index=_internal earliest=09/14/2015:23:59:00 latest=09/16/2015:01:00:00 " -output rawdata -maxout 200000 > c:/test123.dmp
Export data using Splunk Web
Export data using the Splunk REST API
This documentation applies to the following versions of Splunk Cloud™: 7.0.11, 8.0.2004, 7.1.3, 7.1.6, 7.2.10, 7.0.13, 7.2.4, 7.2.6, 7.2.7, 7.2.8, 7.2.9, 8.0.2001, 8.0.2003