Skip to content

Commit d02215b

Browse files
committed
chore(alerts): add timestamp-based filtering for the last 7 days
1 parent 1df4b15 commit d02215b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugins/alerts/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ func isDuplicate(alert *plugins.Alert) bool {
115115
// 1. Filter by Name (always)
116116
bb.FilterTerm("name", alert.Name)
117117

118+
bb.FilterRange("@timestamp", "gte", time.Now().UTC().Add(-24*7*time.Hour).Format(time.RFC3339Nano))
119+
bb.FilterRange("@timestamp", "lte", time.Now().UTC().Format(time.RFC3339Nano))
120+
118121
// Compile regex for array index stripping
119122
reArrayIndex := regexp.MustCompile(`\.[0-9]+(\.|$)`)
120123

0 commit comments

Comments
 (0)