Splunk Search

Why am I getting "splunklb.binding.HTTPError Unknown sid" using the Splunk Python SDK to run a large search?

Builder

I am using Splunk Python API to run a large search of about 144343 events and I keep getting an error that I cannot overcome. Oddly, when I run this same search and reduce the number of events to below 130000, it does not produce this error, but produces results correctly. Below is a copy of the Traceback... I have to run this search with this number of events, so reducing the number of events and the time period is not possible. It's already down to 24 hours which is the minimum.
Thanks for any help.

 File "/xxx/functions.py", line 123, in collect_stats
    result_stream = job.results(count=0)
  File "/xxx/splunklib/client.py", line 2750, in results
    return self.get("results", **query_params).body
  File "/xxx/splunklib/client.py", line 981, in get
    return super(Entity, self).get(path_segment, owner=owner, app=app, sharing=sharing, **query)
  File "/xxx/splunklib/client.py", line 738, in get
    **query)
  File "/xxx/splunklib/binding.py", line 286, in wrapper
    return request_fun(self, *args, **kwargs)
  File "/xxx/splunklib/binding.py", line 68, in new_f
    val = f(*args, **kwargs)
  File "/xxx/splunklib/binding.py", line 660, in get
    response = self.http.get(path, self._auth_headers, **query)
  File "/xxx/splunklib/binding.py", line 1150, in get
    return self.request(url, { 'method': "GET", 'headers': headers })
  File "/xxx/splunklib/binding.py", line 1205, in request
    raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 404 Not Found -- Unknown sid.
0 Karma

Builder

Update to this question... I discovered the problem was that I was printing the results to the console for debugging and the actual search finished much sooner than the printing finished and by the time the printing was done, the job had expired, I guess. Once I ran the job and the parsing into proper data structures afterward, it worked fine. I resolved the need for a debug printing by running the job a second time after the debug printing was done .. not the most efficient solution. Any other possible solutions would be welcome.

0 Karma