Skip to content

Commit cdf1a78

Browse files
author
Ruben van Vreeland
committed
Add threshold rule
1 parent 9dbb62d commit cdf1a78

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

rule_templates/threshold.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Alert when there are 500 discovery detection events coming from the same ip, userAgent within 30 seconds.
2+
3+
# Rule name, must be unique
4+
name: Attack threshold exceeded
5+
6+
# Type of alert.
7+
type: percentage_match
8+
9+
# Alert when this many documents matching the query occur within a timeframe
10+
max_percentage: 10
11+
12+
# num_events must occur within this amount of time to trigger an alert
13+
timeframe:
14+
seconds: 60
15+
16+
# Index to search, wildcard supported
17+
index: bitsensor
18+
timestamp_field: endpoint.localtime
19+
20+
query_key:
21+
- context.ip
22+
23+
# A list of elasticsearch filters used for find events
24+
# These filters are joined with AND and nested in a filtered query
25+
# For more info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html
26+
match_bucket_filter:
27+
- query:
28+
query_string:
29+
query: "_exists_:detections"
30+
31+
include:
32+
- endpoint.location
33+
- endpoint.name
34+
- context.http.userAgent
35+
- context.ip
36+
- context.php.session.sessionId
37+
- detections.type
38+
- detections.name
39+
- meta.user
40+
- errors
41+
42+
alert_subject: "Attack threshold exceeded by {}"
43+
alert_subject_args:
44+
- context.ip
45+
46+
alert_text_type: alert_text_only
47+
alert_text: "Time: {}\nIP: {} \nUser-Agent: {}\n\nID: {}\nUser: {}"
48+
alert_text_args:
49+
- endpoint.localtime
50+
- context.ip
51+
- context.http.userAgent
52+
- _id
53+
- meta.user
54+
55+
# The alert is use when a match is found
56+
alert:
57+
- slack
58+
slack_webhook_url: "https://hooks.slack.com/services/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"
59+
slack_username_override: "ElastAlert"

0 commit comments

Comments
 (0)