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!

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...

Splunk Answers Content Calendar, June Edition II

Get ready to dive into Splunk Dashboard panels this week! We'll be tackling common questions around ...

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...