Getting Data In

Python Rest API script

travismonta
New Member

After connecting to the splunk Rest API, I would like to run a search query built like this and stored in a variable.
hostname is equal to a string variable

searchQuery= "Search | sourcetype=Audit agent_name=hostname| head 5"

I would also like to add in the earliest time as a variable... not sure where to add this. I would then like to return the SID and data in a json format.

Thanks for helping!

0 Karma
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...