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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...