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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...