I'm writing Elastalart
rules for heartbeat i.e if service or machine are/is down, I should get notified. Right now I can create one rule for service per one file like below.
name: My Alert
type: frequency
index: heartbeat-*
num_events: 5
timeframe:
minutes: 2
filter:
- query:
query_string:
query: "url.domain: MY_LOCALHOST01.local AND monitor.status: down"
alert:
- "email"
email:
- "user@example.in"
Is there any way, can I specify multiple rules??... I can specify multiple filter like below
...
filter:
- query: # Filter 1
query_string:
query: "url.domain: MY_LOCALHOST01.local AND monitor.status: down"
- query: # Filter 2
query_string:
query: "url.domain: MY_LOCALHOST02.local AND monitor.status: down"
...
But Elatalert consider num_events
on ALL filters. For example, I dont want to get alert for situation like Filter 1
got 3 hits and Filter 2
got 2 hits i.e 3+2=5 which is equal to num_events
.
So, is there any ways the num_events
should check per filter? like if Filter 1
got 5 hits and Filter 2
got 3 hits, then I can confirm MY_LOCALHOST01
is really DOWN and send alert.
I don't want multiple files. It would be hard to manage/modify.