mirror of
https://github.com/valitydev/SigmaHQ.git
synced 2024-11-08 02:08:54 +00:00
Merge pull request #1622 from frack113/elastalert_issue
Change getRuleName() to get 'id-title' instead of ('id' or 'title')
This commit is contained in:
commit
3d47fec2d8
@ -1171,7 +1171,7 @@ class ElastalertBackend(DeepFieldMappingMixin, MultiRuleOutputMixin):
|
|||||||
for parsed in sigmaparser.condparsed:
|
for parsed in sigmaparser.condparsed:
|
||||||
#Static data
|
#Static data
|
||||||
rule_object = {
|
rule_object = {
|
||||||
"name": rulename + "_" + str(rule_number),
|
"name": rulename,
|
||||||
"description": description,
|
"description": description,
|
||||||
"index": index,
|
"index": index,
|
||||||
"priority": self.convertLevel(level),
|
"priority": self.convertLevel(level),
|
||||||
|
@ -68,9 +68,16 @@ class MultiRuleOutputMixin:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
rulename = sigmaparser.parsedyaml["id"]
|
yaml_id = sigmaparser.parsedyaml["id"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
rulename = sigmaparser.parsedyaml["title"].replace(" ", "-").replace("(", "").replace(")", "")
|
yaml_id = "00000000-0000-0000-0000-000000000000"
|
||||||
|
try:
|
||||||
|
yaml_title = sigmaparser.parsedyaml["title"]
|
||||||
|
except KeyError:
|
||||||
|
yaml_title = "No Title"
|
||||||
|
yaml_title = yaml_title.replace(" ", "-").replace("(", "").replace(")", "")
|
||||||
|
|
||||||
|
rulename = "%s-%s" % (yaml_id, yaml_title)
|
||||||
if rulename in self.rulenames: # add counter if name collides
|
if rulename in self.rulenames: # add counter if name collides
|
||||||
cnt = 2
|
cnt = 2
|
||||||
while "%s-%d" % (rulename, cnt) in self.rulenames:
|
while "%s-%d" % (rulename, cnt) in self.rulenames:
|
||||||
|
Loading…
Reference in New Issue
Block a user