All Apps and Add-ons

Splunk SDK Python Multiple Host

qzhang25
New Member

Hi guys,

I have another question that the if I have multiple host servers, How can I combine them together and run at the same time?
Currently I only know how to work it on a single host.
My code is :

import time
import splunklib.client as client
import splunklib.results as results
import json
import requests
from dateutil.parser import parse

HOST = "host 1"
PORT = 8089
USERNAME = "xxxx"
PASSWORD = "xxxx"

service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)

service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)

while True:
rr = results.ResultsReader(service.jobs.export("splunk query")
for result in rr:
print(result)

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...