Skip to content

Commit

Permalink
Merge pull request #23 from mamercad/oneshot-count
Browse files Browse the repository at this point in the history
Add `count` parameter to Oneshot search
  • Loading branch information
nzlosh authored Feb 22, 2023
2 parents 5eab2e0 + 97812fe commit 06fde46
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 2.2.0

- Add `count` parameter to Oneshot search

## 2.1.2

- Added action to generate or get a HEC token
Expand Down
4 changes: 2 additions & 2 deletions actions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, config):
else:
raise ValueError("No Splunk configuration details found")

def run(self, instance, query):
def run(self, instance, query, count):
"""stackstorm run method"""
# Find config details
if instance:
Expand Down Expand Up @@ -52,7 +52,7 @@ def run(self, instance, query):
"Failed to connect to Splunk Instance {} with error {}".format(splunk_config, err)
)

result = self.service.jobs.oneshot(query, params={"output_mode": "json"})
result = self.service.jobs.oneshot(query, params={"output_mode": "json", "count": count})
reader = results.ResultsReader(result)
search_results = []

Expand Down
6 changes: 6 additions & 0 deletions actions/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ parameters:
description: "Search query (e.g. 'search * | head 10')"
required: true
position: 1
count:
type: integer
description: "The maximum number of items to return"
required: true
position: 2
default: 100
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- splunk
- monitoring
- alerting
version: 2.1.2
version: 2.2.0
author : StackStorm, Inc.
email : [email protected]
python_versions:
Expand Down

0 comments on commit 06fde46

Please sign in to comment.