2

I need to run a rule at 2 am, querying logs from 0 to 2 am, and alert if matches are found.

So far all the rules I created are frequency rules, but I don't know how to achieve the specific time range for the query, and a specific time for the alert, can someone please help?

(I guess the ANY type could let me add my time range as part of the filter....but then how can I run the rule at 2 am every day?)

Sebastian Slutzky
  • 382
  • 1
  • 5
  • 22

3 Answers3

0

In UTC:

filter:
  range:
    "@timestamp":
      gte: "now/d+0h"
      lt: "now/d+2h"
Unheilig
  • 16,196
  • 193
  • 68
  • 98
0

The now is take the time of the server.

filter:
 - range:
   "@timestamp":
      "from": "now-2h"
       "to": "now"
pioupiou
  • 836
  • 2
  • 14
  • 29
0

if you want your alert to be effective for specific hours only, you can create an enhancement that drop the alert if the current time doesnt match your needs check https://elastalert.readthedocs.io/en/latest/recipes/adding_enhancements.html

regards

greg
  • 1