Getting Data In

Why I am getting this error ? every credential is correctly provided?

ramesh12345
Explorer

import splunklib.client as client

HOST = "Host IP"
PORT = 8089
USERNAME = "my username"
PASSWORD = "password"

# Create a Service instance and log in
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)

# Print installed apps to the console to verify login
for app in service.apps:
print app.name

Traceback (most recent call last):
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 861, in login
cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 1208, in post
return self.request(url, message)
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 1228, in request
raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 401 Unauthorized -- Login failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Users\name\pyton programs\test.py", line 20, in
password=PASSWORD)
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\client.py", line 325, in connect
s.login()
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 869, in login
raise AuthenticationError("Login failed.", he)
splunklib.binding.AuthenticationError: Login failed.

Tags (2)

vasanthi77
Explorer

facing same issue, have you resolved this one?

0 Karma

_robind
Engager

I have the same issue. I found this "you must contact Splunk to ensure that the credentials being used have access to the API on port 8089"
here:
https://interset.zendesk.com/hc/en-us/articles/115004545887-com-splunk-HttpException-HTTP-401-Login-...
Please respond if you managed to get this working, I am struggling to get a response from Splunk (I cannot raise a request ticket).

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...