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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...