Skip to content

Commit

Permalink
Merge pull request #36 from fastly/release-1036
Browse files Browse the repository at this point in the history
splunk-ta 1.0.36
  • Loading branch information
brectanus-sigsci authored Aug 15, 2023
2 parents fe5548d + 4a04ca3 commit b140022
Show file tree
Hide file tree
Showing 17 changed files with 254 additions and 259 deletions.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file added sigsci_TA_for_splunk-1.0.36.tgz
Binary file not shown.
22 changes: 22 additions & 0 deletions sigsci_TA_for_splunk/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,25 @@ This is an add-on powered by the Splunk Add-on Builder.
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/markupsafe/_speedups.cpython-37m-x86_64-linux-gnu.so: this file does not require any source code
# Binary File Declaration
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/pvectorc.cpython-37m-x86_64-linux-gnu.so: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/markupsafe/_speedups.cpython-37m-x86_64-linux-gnu.so: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-32.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-32.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-64.exe: this file does not require any source code
# Binary File Declaration
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/pvectorc.cpython-37m-x86_64-linux-gnu.so: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/markupsafe/_speedups.cpython-37m-x86_64-linux-gnu.so: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-32.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-arm64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-64.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/gui-32.exe: this file does not require any source code
/opt/splunk/var/data/tabuilder/package/sigsci_TA_for_splunk/bin/sigsci_ta_for_splunk/aob_py3/setuptools/cli-64.exe: this file does not require any source code
8 changes: 4 additions & 4 deletions sigsci_TA_for_splunk/README/inputs.conf.spec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[SigsciActivity://<name>]
place_holder = It was required to have one option even if it isn't needed. You can skip this one.

[SigsciEvent://<name>]
site_api_name = This is the Site API Name. It should not be a URL.

[SigsciRequests://<name>]
site_api_name = This is the API Name of the site to pull date from. This should not be a URL.
site_api_name = This is the API Name of the site to pull request data from. This should not be a URL.

[SigsciActivity://<name>]
place_holder = It was required to have one option even if it isn't needed. You can skip this one.
2 changes: 1 addition & 1 deletion sigsci_TA_for_splunk/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": {
"group": null,
"name": "sigsci_TA_for_splunk",
"version": "1.0.35"
"version": "1.0.36"
},
"author": [
{
Expand Down
48 changes: 24 additions & 24 deletions sigsci_TA_for_splunk/appserver/static/js/build/globalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@
"field": "disabled",
"label": "Status"
},
{
"field": "place_holder",
"label": "Place Holder"
},
{
"field": "site_api_name",
"label": "Site API Name"
},
{
"field": "place_holder",
"label": "Place Holder"
}
],
"actions": [
Expand All @@ -261,8 +261,8 @@
},
"services": [
{
"name": "SigsciActivity",
"title": "SigsciActivity",
"name": "SigsciEvent",
"title": "SigsciEvent",
"entity": [
{
"field": "name",
Expand Down Expand Up @@ -319,10 +319,10 @@
]
},
{
"field": "place_holder",
"label": "Place Holder",
"help": "It was required to have one option even if it isn't needed. You can skip this one.",
"required": false,
"field": "site_api_name",
"label": "Site API Name",
"help": "This is the Site API Name. It should not be a URL.",
"required": true,
"type": "text",
"validators": [
{
Expand All @@ -331,16 +331,13 @@
"maxLength": 8192,
"errorMsg": "Max length of text input is 8192"
}
],
"options": {
"placeholder": "Not needed"
}
]
}
]
},
{
"name": "SigsciEvent",
"title": "SigsciEvent",
"name": "SigsciRequests",
"title": "SigsciRequests",
"entity": [
{
"field": "name",
Expand Down Expand Up @@ -399,7 +396,7 @@
{
"field": "site_api_name",
"label": "Site API Name",
"help": "This is the Site API Name. It should not be a URL.",
"help": "This is the API Name of the site to pull request data from. This should not be a URL.",
"required": true,
"type": "text",
"validators": [
Expand All @@ -414,8 +411,8 @@
]
},
{
"name": "SigsciRequests",
"title": "SigsciRequests",
"name": "SigsciActivity",
"title": "SigsciActivity",
"entity": [
{
"field": "name",
Expand Down Expand Up @@ -472,10 +469,10 @@
]
},
{
"field": "site_api_name",
"label": "Site API Name",
"help": "This is the API Name of the site to pull date from. This should not be a URL.",
"required": true,
"field": "place_holder",
"label": "Place Holder",
"help": "It was required to have one option even if it isn't needed. You can skip this one.",
"required": false,
"type": "text",
"validators": [
{
Expand All @@ -484,7 +481,10 @@
"maxLength": 8192,
"errorMsg": "Max length of text input is 8192"
}
]
],
"options": {
"placeholder": "Not needed"
}
}
]
}
Expand Down
49 changes: 20 additions & 29 deletions sigsci_TA_for_splunk/bin/input_module_SigsciActivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from datetime import datetime
from sigsci_helper import get_from_and_until_times, Config, get_results, get_until_time

'''
"""
IMPORTANT
Edit only the validate_input and collect_events functions.
Do not edit any other part in this file.
This file is generated only once when creating the modular input.
'''
"""


# def use_single_instance_mode():
Expand All @@ -30,23 +30,21 @@ def collect_events(helper, ew):
global_email = helper.get_global_setting("email")
global_api_token = helper.get_global_setting("api_token")
global_corp_api_name = helper.get_global_setting("corp_api_name")
api_host = 'https://dashboard.signalsciences.net'
api_host = "https://dashboard.signalsciences.net"
helper.log_info("email: %s" % global_email)
helper.log_info("corp: %s" % global_corp_api_name)

def pull_events(delta, key=None):
last_run_until = helper.get_check_point("activity_last_until_time")
helper.log_info(f"last_run_until: {last_run_until}")
if last_run_until is None:
(
until_time,
from_time
) = get_from_and_until_times(delta, five_min_offset=False)
(until_time, from_time) = get_from_and_until_times(
delta, five_min_offset=False
)
else:
(
until_time,
from_time
) = get_until_time(last_run_until, delta, five_min_offset=False)
(until_time, from_time) = get_until_time(
helper, last_run_until, delta, five_min_offset=False
)
if from_time is None:
helper.log_info(f"{last_run_until} >= current now time, skipping run")
return
Expand Down Expand Up @@ -88,13 +86,13 @@ def pull_events(delta, key=None):
until_time=until_time,
global_email=global_email,
global_corp_api_name=global_corp_api_name,
current_site='',
current_site="",
)
config.headers = {
'Content-type': 'application/json',
'x-api-user': global_email,
'x-api-token': global_api_token,
'User-Agent': config.user_agent_string
"Content-type": "application/json",
"x-api-user": global_email,
"x-api-token": global_api_token,
"User-Agent": config.user_agent_string,
}
helper.log_info("Pulling results from Corp Activity API")
all_events = get_results("Activity Events", helper, config)
Expand Down Expand Up @@ -122,7 +120,7 @@ def pull_events(delta, key=None):
source=single_name,
index=helper.get_output_index(),
sourcetype=source_type,
data=current_event
data=current_event,
)
else:
indexes = helper.get_output_index()
Expand All @@ -139,7 +137,7 @@ def pull_events(delta, key=None):
source=single_name,
index=current_index,
sourcetype=source_type,
data=current_event
data=current_event,
)

try:
Expand All @@ -149,30 +147,23 @@ def pull_events(delta, key=None):
write_end = timer()
write_time = write_end - write_start
write_time_result = round(write_time, 2)
helper.log_info(
f"Total Corp Activity Output Time: {write_time_result} seconds"
)
helper.log_info(f"Total Corp Activity Output Time: {write_time_result} seconds")

# If multiple inputs configured it creates an array of values and the
# script only gets called once per Input configuration
time_deltas = helper.get_arg('interval')
time_deltas = helper.get_arg("interval")
helper.log_info(f"interval: {time_deltas}")
if type(time_deltas) is dict:
helper.log_info("run_type: Sequential")
for active_input in time_deltas:
time_delta = time_deltas[active_input]
time_delta = int(time_delta)
helper.log_info("time_delta: %s" % time_delta)
pull_events(
delta=time_delta,
key=active_input
)
pull_events(delta=time_delta, key=active_input)
else:
helper.log_info("Run Type: Concurrent")
helper.log_info("time_delta: %s" % time_deltas)
pull_events(
delta=int(time_deltas)
)
pull_events(delta=int(time_deltas))
helper.log_info("Finished Pulling Corp Activity")
end = timer()
total_time = end - start
Expand Down
Loading

0 comments on commit b140022

Please sign in to comment.