Splunk Search

Why does Splunk module python script get an SSL error?

rockzers
Path Finder

how to access splunk using python script

when i run this code i get an error

import splunklib.client as client
service = client.connect(host='192.0.0.1', port=8000, username='username', password='password',verify=False) 
print(service)

shows an error

ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)
Labels (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

splunklib.client is meant to connect to Splunk's REST API, which runs on port 8089 by default, not port 8000.   Unless you specifically changed configuration, that service at port 8000 is the Web user interface with plain text HTTP.  See example in Use Python SDK to export data.

View solution in original post

0 Karma

yuanliu
SplunkTrust
SplunkTrust

splunklib.client is meant to connect to Splunk's REST API, which runs on port 8089 by default, not port 8000.   Unless you specifically changed configuration, that service at port 8000 is the Web user interface with plain text HTTP.  See example in Use Python SDK to export data.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...