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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...