Splunk Dev

[WinError 10061] Export data using the Splunk SDKs not working?

CarbonCriterium
Path Finder

Apologies if these are very basic questions but I am new to the API and the SDK.  I am running the script below following the guidelines provided in the documentation, but I am getting the following error.  Can anyone point me in the correct direction?

https://docs.splunk.com/Documentation/Splunk/8.1.0/Search/ExportdatausingSDKs

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

 

 

import splunklib.client as client
import splunklib.results as results

HOST =  
PORT = 8089
USERNAME =  
PASSWORD =  


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

rr = results.ResultsReader(service.jobs.export("search index=_internal earliest=-1h | head 5"))

for result in rr:
    if isinstance(result, results.Message):
        # Diagnostic messages might be returned in the results
        data=(result.type, result.message)
        string_format="%s:%s"
        print(string_format % data)
    elif isinstance(result, dict):
        # Normal events are returned as dicts
        print(result)
assert rr.is_preview == False

 

 

Labels (3)
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...