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!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...