-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from splunk/Release-1.6.18
Release 1.6.18
- Loading branch information
Showing
46 changed files
with
439 additions
and
1,193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
splunk-sdk-python github_forks example | ||
======================================== | ||
|
||
This app provides an example of a modular input that generates the number of repository forks according to the Github API based on the owner and repo_name provided by the user during setup of the input. | ||
|
||
To run this example locally run `SPLUNK_VERSION=latest docker compose up -d` from the root of this repository which will mount this example alongside the latest version of splunklib within `/opt/splunk/etc/apps/github_forks` and `/opt/splunk/etc/apps/github_forks/lib/splunklib` within the `splunk` container. | ||
|
||
Once the docker container is up and healthy log into the Splunk UI and setup a new `Github Repository Forks` input by visiting this page: http://localhost:8000/en-US/manager/github_forks/datainputstats and selecting the "Add new..." button next to the Local Inputs > Random Inputs. Enter values for a Github Repository owner and repo_name, for example owner = `splunk` repo_name = `splunk-sdk-python`. | ||
|
||
NOTE: If no Github Repository Forks input appears then the script is likely not running properly, see https://docs.splunk.com/Documentation/SplunkCloud/latest/AdvancedDev/ModInputsDevTools for more details on debugging the modular input using the command line and relevant logs. | ||
|
||
Once the input is created you should be able to see an event when running the following search: `source="github_forks://*"` the event should contain fields for `owner` and `repository` matching the values you input during setup and then a `fork_count` field corresponding to the number of forks the repo has according to the Github API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
splunk-sdk-python random_numbers example | ||
======================================== | ||
|
||
This app provides an example of a modular input that generates a random number between the min and max values provided by the user during setup of the input. | ||
|
||
To run this example locally run `SPLUNK_VERSION=latest docker compose up -d` from the root of this repository which will mount this example alongside the latest version of splunklib within `/opt/splunk/etc/apps/random_numbers` and `/opt/splunk/etc/apps/random_numbers/lib/splunklib` within the `splunk` container. | ||
|
||
Once the docker container is up and healthy log into the Splunk UI and setup a new `Random Numbers` input by visiting this page: http://localhost:8000/en-US/manager/random_numbers/datainputstats and selecting the "Add new..." button next to the Local Inputs > Random Inputs. Enter values for the `min` and `max` values which the random number should be generated between. | ||
|
||
NOTE: If no Random Numbers input appears then the script is likely not running properly, see https://docs.splunk.com/Documentation/SplunkCloud/latest/AdvancedDev/ModInputsDevTools for more details on debugging the modular input using the command line and relevant logs. | ||
|
||
Once the input is created you should be able to see an event when running the following search: `source="random_numbers://*"` the event should contain a `number` field with a float between the min and max specified when the input was created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import sys | ||
import os | ||
# import from utils/__init__.py | ||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) | ||
from utils import * | ||
import time | ||
from splunklib.client import connect | ||
from splunklib import results | ||
from splunklib import six | ||
|
||
def cmdline(argv, flags, **kwargs): | ||
"""A cmdopts wrapper that takes a list of flags and builds the | ||
corresponding cmdopts rules to match those flags.""" | ||
rules = dict([(flag, {'flags': ["--%s" % flag]}) for flag in flags]) | ||
return parse(argv, rules, ".splunkrc", **kwargs) | ||
|
||
def modes(argv): | ||
opts = cmdline(argv, []) | ||
kwargs_splunk = dslice(opts.kwargs, FLAGS_SPLUNK) | ||
service = connect(**kwargs_splunk) | ||
|
||
# By default the job will run in 'smart' mode which will omit events for transforming commands | ||
job = service.jobs.create('search index=_internal | head 10 | top host') | ||
while not job.is_ready(): | ||
time.sleep(0.5) | ||
pass | ||
reader = results.ResultsReader(job.events()) | ||
# Events found: 0 | ||
print('Events found with adhoc_search_level="smart": %s' % len([e for e in reader])) | ||
|
||
# Now set the adhoc_search_level to 'verbose' to see the events | ||
job = service.jobs.create('search index=_internal | head 10 | top host', adhoc_search_level='verbose') | ||
while not job.is_ready(): | ||
time.sleep(0.5) | ||
pass | ||
reader = results.ResultsReader(job.events()) | ||
# Events found: 10 | ||
print('Events found with adhoc_search_level="verbose": %s' % len([e for e in reader])) | ||
|
||
if __name__ == "__main__": | ||
modes(sys.argv[1:]) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.