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!

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...