Getting Data In

Does anyone know how to convert a savedsearch request to a REST API endpoint request?

kmugglet
Communicator

Does anyone know how to convert this savedsearch request to a REST endpoint request?

|savedsearch mysearch replace_me="value"

I can run a normal savedsearch "apm_cvc_qtr_bh_test" using curl in the app apm_snpm

curl -k -u svc_user_bob:password https://localhost:8089/servicesNS/svc_user_bob/apm_snpm/saved/searches/apm_cvc_qtr_bh_test/dispatch -d trigger_actions=1

but i don't know how to pass the replace_me key and value

Any ideas?

1 Solution

kmugglet
Communicator

For the rest call

curl -k u user:password https://blah.local:8089/servicesNS/svc_usr_bob/apm_snpm/saved/searches/apm_cvc_qtr_bh_test/dispatch -d trigger_actions=1 -d args.startDate="-3d" -d args.endDate="-0d"

in the saved search

eventtype=service-CombinedForwardingPlaneQueueGroupServiceIngressLogRecord earliest=$args.startDate$ latest=$args.endDate$

I should work for the NSA after decrypting the Splunk doco

View solution in original post

kmugglet
Communicator

For the rest call

curl -k u user:password https://blah.local:8089/servicesNS/svc_usr_bob/apm_snpm/saved/searches/apm_cvc_qtr_bh_test/dispatch -d trigger_actions=1 -d args.startDate="-3d" -d args.endDate="-0d"

in the saved search

eventtype=service-CombinedForwardingPlaneQueueGroupServiceIngressLogRecord earliest=$args.startDate$ latest=$args.endDate$

I should work for the NSA after decrypting the Splunk doco

somesoni2
Revered Legend

See this example

http://answers.splunk.com/answers/8945/how-to-start-a-saved-search-using-rest-api.html

you can just give your "|savedsearch" command as search query in curl.

0 Karma

kmugglet
Communicator

Thanks, but I couldn't see in there how to pass the values for a template search...

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...