Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few fix splunk driver #688

Merged
merged 9 commits into from
Aug 8, 2023
9 changes: 7 additions & 2 deletions msticpy/data/drivers/splunk_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def query(
# Get sets of N results at a time, N=100 by default
page_size = kwargs.pop("page_size", 100)

# default to 60s unless timeout is specified
timeout = kwargs.pop("timeout", 60)

# Normal (non-blocking) searches or oneshot (blocking) searches.
# Defaults to Normal(non-blocking)

Expand All @@ -255,7 +258,9 @@ def query(
query_job = self.service.jobs.create(
query, count=count, **kwargs_normalsearch
)
resp_rows, reader = self._exec_async_search(query_job, page_size, **kwargs)
resp_rows, reader = self._exec_async_search(
query_job, page_size, timeout=timeout
)

if len(resp_rows) == 0 or not resp_rows:
print("Warning - query did not return any results.")
Expand Down Expand Up @@ -333,7 +338,7 @@ def driver_queries(self) -> Iterable[Dict[str, Any]]:
]
return []

def _exec_async_search(self, query_job, page_size, timeout=60):
def _exec_async_search(self, query_job, page_size, timeout):
"""Execute an async search and return results."""
# Initiate progress bar and start while loop, waiting for async query to complete
progress_bar = tqdm(total=100, desc="Waiting Splunk job to complete")
Expand Down