Hi guys,
I'm using the sample script to connect with my environment using the Splunk Python SDK. For the development environment this works, but for the production environment, it doesn't work. Both endpoints of Splunk use https for connection.
Following the code:
import splunklib.client as client
HOST = "myEndPoint"
PORT = 8089
USERNAME = "admin"
PASSWORD = "changeme"
# 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:
Traceback (most recent call last):
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunk_Connet.py", line 13, in
password=PASSWORD)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\client.py", line 321, in connect
s.login()
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 857, in login
cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1201, in post
return self.request(url, message)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1218, in request
response = self.handler(url, message, **kwargs)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1357, in request
connection.request(method, path, body, head)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1057, in request
self._send_request(method, url, body, headers)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1097, in _send_request
self.endheaders(body)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 897, in _send_output
self.send(msg)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 859, in send
self.connect()
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1270, in connect
HTTPConnection.connect(self)
File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 836, in connect
self.timeout, self.source_address)
File "C:\Python27\lib\socket.py", line 575, in create_connection
raise err
socket.error: [Finished in 21.6s]
Hi guys,
This error stoped of occur magically 🙂. I believe that I was blocked for any rule in my network.
Hi guys,
This error stoped of occur magically 🙂. I believe that I was blocked for any rule in my network.