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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...