Splunk Team,
I’m trying to connect to splunk server using Splunk SDK for python and having following error which I’m unable to debug.
Can you please advise and steer me in the right direction.
File "connect_splk.py", line 17, in
password=PASSWORD)
File "/usr/lib/python2.7/site-packages/splunklib/client.py", line 321, in connect
s.login()
File "/usr/lib/python2.7/site-packages/splunklib/binding.py", line 860, in login
session = XML(body).findtext("./sessionKey")
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1312, in XML
return parser.close()
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1665, in close
self._raiseerror(v)
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1517, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
Code:
import splunklib.client as client
HOST = ""
PORT = “”
USERNAME = ""
PASSWORD = ""
# Create a Service instance and log in
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
# Printing installed apps to the console to verify login
for app in service.apps:
print app.name;
Please advise.
Nidhi
... View more