Splunk Enterprise

Searching from a specific app on splunk server using python sdk

neilgupte75
New Member

Hey I am new to splunk and wanted to know how to carry out searches from inside a specific app through python sdk.

My search query is for a specific app and does not produce any results if I search it in global search and reporting.

I have established the connection with the server but as the query needs to be searched from inside a specific app I am not able to get any results.

Help will be appreciated.

Is there an app parameter which is required while connecting to the server 

 

 

My connection code is 

import splunklib.client as client

HOST = "hostname"
PORT = "8089"
USERNAME = "uname"
PASSWORD = "passwd"


# Create a Service instance and log in
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD
)

# Print installed apps to the console to verify login
for app in service.apps:
print (app.name)

kwargs_export = {"earliest_time": "-1h",
"latest_time": "now",
"search_mode": "normal"}
searchquery_export = 'myquery'
exportsearch_results = service.jobs.export(searchquery_export, **kwargs_export)

# Get the results and display them using the ResultsReader
reader = results.ResultsReader(exportsearch_results)
for result in reader:
if isinstance(result, dict😞
print ("Result: %s" % result)
elif isinstance(result, results.Message):
# Diagnostic messages may be returned in the results
print("Message: %s" % result)

# Print whether results are a preview from a running search
print ("is_preview = %s " % reader.is_preview)
Labels (2)
Tags (2)
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...