Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Fix/deletion of index (#178)
Browse files Browse the repository at this point in the history
* feat: additional data extraction

* fix: build fix

* fix: build fix

* fix: build fix

* fix: build fix

* fix: build fix

* fix: build fix

* fix: build fix

* fix: build fix

* Update tests/test_additional_data_extraction.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: delete duplicated license

* fix: delete last indexes

* fix: delete index for every scenario without regex

* fix: delete index for every scenario without regex

Co-authored-by: weliasz <weliasz@splunk.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 2, 2021
1 parent 4dfa7fd commit 7b2c929
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions splunk_connect_for_snmp_poller/manager/hec_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def build_metric_data(
def extract_additional_properties(fields, metric_name, metric_value, server_config):
result = multi_key_lookup(server_config, (enricher_name, enricher_oid_family))
oid_families = result if result else []
any_regex_matched = False

for family in oid_families.keys():
if metric_name.startswith("sc4snmp." + family):
Expand All @@ -226,6 +227,7 @@ def extract_additional_properties(fields, metric_name, metric_value, server_conf

result = re.match(regex, input_text)
if result:
any_regex_matched = True
for index, item in enumerate(names_list):
fields[item] = result.group(index + 1)
del fields["metric_name:" + metric_name]
Expand All @@ -234,6 +236,11 @@ def extract_additional_properties(fields, metric_name, metric_value, server_conf
fields["old_metric_name:" + metric_name] = metric_value
continue

if not any_regex_matched:
fields["index_number"] = input_text
del fields["metric_name:" + metric_name]
fields["metric_name:" + stripped] = metric_value


def build_error_data(
host,
Expand Down

0 comments on commit 7b2c929

Please sign in to comment.