From cea8e603d85d37665301033afb5e047becdd1e40 Mon Sep 17 00:00:00 2001 From: Alberto Papaleo Date: Thu, 7 Dec 2023 12:29:41 -0500 Subject: [PATCH 1/5] Fix count parameter location --- actions/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/search.py b/actions/search.py index ee7f627..9aa34fc 100644 --- a/actions/search.py +++ b/actions/search.py @@ -52,7 +52,7 @@ def run(self, instance, query, count): "Failed to connect to Splunk Instance {} with error {}".format(splunk_config, err) ) - result = self.service.jobs.oneshot(query, params={"output_mode": "json", "count": count}) + result = self.service.jobs.oneshot(query, count=count, params={"output_mode": "json"}) reader = results.ResultsReader(result) search_results = [] From 893cc9953a9dbc0ded376b6b57a065a9c0d77075 Mon Sep 17 00:00:00 2001 From: Alberto Papaleo Date: Thu, 7 Dec 2023 12:44:34 -0500 Subject: [PATCH 2/5] add offset parameter --- CHANGES.md | 5 +++++ actions/search.py | 6 +++--- actions/search.yaml | 6 ++++++ pack.yaml | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b3fcafc..229d8ef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Change Log +## 2.2.1 + +- Refactor params for Oneshot search +- Change ResultReader to JSONResultReader + ## 2.2.0 - Add `count` parameter to Oneshot search diff --git a/actions/search.py b/actions/search.py index 9aa34fc..ce765de 100644 --- a/actions/search.py +++ b/actions/search.py @@ -23,7 +23,7 @@ def __init__(self, config): else: raise ValueError("No Splunk configuration details found") - def run(self, instance, query, count): + def run(self, instance, query, count, offset): """stackstorm run method""" # Find config details if instance: @@ -52,8 +52,8 @@ def run(self, instance, query, count): "Failed to connect to Splunk Instance {} with error {}".format(splunk_config, err) ) - result = self.service.jobs.oneshot(query, count=count, params={"output_mode": "json"}) - reader = results.ResultsReader(result) + result = self.service.jobs.oneshot(query, count=count, offset=offset, output_mode='json') + reader = results.JSONResultsReader(result) search_results = [] for item in reader: diff --git a/actions/search.yaml b/actions/search.yaml index 1310cc7..1f60a96 100644 --- a/actions/search.yaml +++ b/actions/search.yaml @@ -20,3 +20,9 @@ parameters: required: true position: 2 default: 100 + offset: + type: integer + description: "A number that specifies the index of the first entity to return" + required: true + position: 3 + default: 0 diff --git a/pack.yaml b/pack.yaml index 0bd46ad..fda9e1a 100644 --- a/pack.yaml +++ b/pack.yaml @@ -6,7 +6,7 @@ keywords: - splunk - monitoring - alerting -version: 2.2.0 +version: 2.2.1 author : StackStorm, Inc. email : info@stackstorm.com python_versions: From 9f5094786fb25766c0c41052ff255e9b8069c128 Mon Sep 17 00:00:00 2001 From: bertyah <109681750+bertyah@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:52:07 -0500 Subject: [PATCH 3/5] Update CHANGES.md bump minor version Co-authored-by: Eugen C. <1533818+armab@users.noreply.github.com> --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 229d8ef..71573c0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Change Log -## 2.2.1 +## 2.3.0 - Refactor params for Oneshot search - Change ResultReader to JSONResultReader From cde130a56b54b72b67e28ece57bc7f23cb8b341a Mon Sep 17 00:00:00 2001 From: bertyah <109681750+bertyah@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:55:00 -0500 Subject: [PATCH 4/5] Update CHANGES.md add reason for JSONResultReader Change --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 71573c0..1d716e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,7 +3,7 @@ ## 2.3.0 - Refactor params for Oneshot search -- Change ResultReader to JSONResultReader +- Change ResultReader to JSONResultReader to fix the ResultsReader deprecated function. ## 2.2.0 From c76b8ab151401b99d4873a2d3a95c019cb93af21 Mon Sep 17 00:00:00 2001 From: bertyah <109681750+bertyah@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:58:07 -0500 Subject: [PATCH 5/5] Update pack.yaml update minor version Co-authored-by: Eugen C. <1533818+armab@users.noreply.github.com> --- pack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack.yaml b/pack.yaml index fda9e1a..38c131a 100644 --- a/pack.yaml +++ b/pack.yaml @@ -6,7 +6,7 @@ keywords: - splunk - monitoring - alerting -version: 2.2.1 +version: 2.3.0 author : StackStorm, Inc. email : info@stackstorm.com python_versions: