From 1bc7fe0bb525dade42a6e82b19aaee91f0f73028 Mon Sep 17 00:00:00 2001 From: darius Date: Mon, 27 May 2024 13:25:16 +0200 Subject: [PATCH] notify threshold --- wazuh-notify-go/services/init.go | 3 +++ wazuh-notify-go/types/types.go | 1 + 2 files changed, 4 insertions(+) diff --git a/wazuh-notify-go/services/init.go b/wazuh-notify-go/services/init.go index c8f8450..5c86064 100644 --- a/wazuh-notify-go/services/init.go +++ b/wazuh-notify-go/services/init.go @@ -81,6 +81,9 @@ func wazuhInput() { for i, _ := range configParams.PriorityMap { if slices.Contains(configParams.PriorityMap[i].ThreatMap, wazuhData.Parameters.Alert.Rule.Level) { + if inputParams.WazuhMessage.Parameters.Alert.Rule.Firedtimes%inputParams.PriorityMap[i].NotifyThreshold != 0 { + os.Exit(0) + } inputParams.Color = inputParams.PriorityMap[i].Color if inputParams.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= inputParams.PriorityMap[i].MentionThreshold { inputParams.Mention = "@here" diff --git a/wazuh-notify-go/types/types.go b/wazuh-notify-go/types/types.go index f20f8ff..7e4453f 100644 --- a/wazuh-notify-go/types/types.go +++ b/wazuh-notify-go/types/types.go @@ -23,6 +23,7 @@ type General struct { type PriorityMap struct { ThreatMap []int `toml:"threat_map"` MentionThreshold int `toml:"mention_threshold"` + NotifyThreshold int `toml:"notify_threshold"` Color int `toml:"color"` } type MarkdownEmphasis struct {