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!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...