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!

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