Splunk Cloud Platform

Failure in fetching Index names in SplunkCloud using splunklib.client.connect?

jabezds
Path Finder

Hi ,

We are facing issues in listing available splunk indexes in SplunkCloud using  splunklib.client.connect provided by splunklib library.

Below is the code snippet used:

service = splunklib.client.connect(host=host, token=session_token)
ind_list = service.indexes.list()

This code works perfectly fine in the splunk enterprise and previous splunk cloud versions but noticed this issues happening on the latest versions (8.2.2202 and above).

When this code executes on the 8.2.2202 and above we notices the following debug line, which clearly shows the timeout error while fetching the indexes as below:

We see this timeout error because the splunk  is not returning the index names ,since it is failing to connect to splunk cloud.

ERROR 2022-10-03 05:39:22,296 CiscoCloudSecurity : API: fetch_indexes, Exception : [Errno 110] Connection timed out
Traceback (most recent call last):
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/fetch_indexes.py", line 26, in handle
ind_list = service.indexes.list()
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/client.py", line 1479, in list
return list(self.iter(count=count, **kwargs))
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/client.py", line 1438, in iter
response = self.get(count=pagesize or count, offset=offset, **kwargs)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/client.py", line 1668, in get
return super(Collection, self).get(name, owner, app, sharing, **query)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/client.py", line 766, in get
**query)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 290, in wrapper
return request_fun(self, *args, **kwargs)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 71, in new_f
val = f(*args, **kwargs)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 686, in get
response = self.http.get(path, all_headers, **query)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 1199, in get
return self.request(url, { 'method': "GET", 'headers': headers })
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 1259, in request
response = self.handler(url, message, **kwargs)
File "/opt/splunk/etc/apps/cisco-cloud-security/bin/splunklib/binding.py", line 1399, in request
connection.request(method, path, body, head)
File "/opt/splunk/lib/python3.7/http/client.py", line 1281, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/splunk/lib/python3.7/http/client.py", line 1327, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/splunk/lib/python3.7/http/client.py", line 1276, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/splunk/lib/python3.7/http/client.py", line 1036, in _send_output
self.send(msg)
File "/opt/splunk/lib/python3.7/http/client.py", line 976, in send
self.connect()
File "/opt/splunk/lib/python3.7/http/client.py", line 1443, in connect
super().connect()
File "/opt/splunk/lib/python3.7/http/client.py", line 948, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/opt/splunk/lib/python3.7/socket.py", line 728, in create_connection
raise err
File "/opt/splunk/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

Please let us know how we can resolve this issue on cloud .

Thanks.

 

Tags (1)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...