Splunk Search

CLI Search - Export JSON File?

cramasta
Builder

Can I run a CLI search that will output the results to a file in json format?
Thanks,
Joe

Tags (1)

scelikok
SplunkTrust
SplunkTrust

Hi @zsbbb,

You can export any search output as json using below sample;

curl -k -u admin:changeme https://localhost:8089/services/search/jobs/export -d search="search sourcetype=access_* earliest=-7d" -d output_mode=json -o /path/to/local/file.json
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

zsbbb
Engager

New to splunk and bringing this back up - how does one do this? 

For context, I have a splunk container running on docker, and was hoping to translate the splunk index data into json using a cli search and saving the output as a local file.

 

Thanks!

Tags (3)
0 Karma

araitz
Splunk Employee
Splunk Employee

Coming soon to a Splunk version near you, watch the release notes...

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

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