Splunk Search

running splunk search using python sdk

harsh1734
New Member

hi,
i have installed python sdk and in ./splunkrc file given user name and passwd so that it can connect my splunk ..i have a index name called test. so what should be my search so that by using my python sdk i can call that index content

Tags (1)
0 Karma

HiroshiSatoh
Champion

What error is the output? Do you have made ​​well Preferences?
For example, this sample program work?

Please to save and run the file with the appropriate name by setting the HOST,USERNAME,PASSWORD.
---------(sample program)------------------
import splunklib.client as client

HOST = "hostxxxx"
PORT = 8089
USERNAME = "username"
PASSWORD = "password"

try:
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
print "connect OK!"
except:

print "connect NG!"

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...