Skip to content

Commit c537ca6

Browse files
author
Khanh Nguyen
committed
Added bitsensor enhancement module
1 parent 599ec7e commit c537ca6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

elastalert_modules/__init__.py

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from elastalert.enhancements import BaseEnhancement
2+
from util import convert_array_to_object
3+
4+
5+
class AlertTextEnhancement(BaseEnhancement):
6+
# The enhancement is run against every match
7+
# The match is passed to the process function where it can be modified in any way
8+
# ElastAlert will do this for each enhancement linked to a rule
9+
def process(self, match):
10+
match['detections_string'] = ''
11+
if 'detections' in match:
12+
match['detections_parsed'] = convert_array_to_object(match['detections'])

elastalert_modules/util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
def convert_array_to_object(array):
4+
json = {}
5+
for idx in range(len(array)):
6+
json[idx] = array[idx]
7+
return json

0 commit comments

Comments
 (0)