martin
martin

Reputation: 1

Elastic observability heartbeat interval date

I'm using elastic to make hearbeats every 1 minute to my API, if there is error send an email. I create the rule from elastic UI, as showing in this image

Image

but what I need is only trigger the rule (heartbeat) within 20:00 until 21:00 every 1 minute.

is that possible ?

Upvotes: 0

Views: 56

Answers (1)

Ashish Tiwari
Ashish Tiwari

Reputation: 2277

You can achieve this by adding below cron expression in heartbeat.yml file -

- type: http
  id: myhost
  name: My HTTP Host
  schedule: '* */1 20-21 * * * *'
  hosts: ["http://myhost:80"]

The schedule option uses a cron-like syntax based on this cronexpr implementation.

From the doc -

Field name     Mandatory?   Allowed values    Allowed special characters
----------     ----------   --------------    --------------------------
Seconds        No           0-59              * / , -
Minutes        Yes          0-59              * / , -
Hours          Yes          0-23              * / , -
Day of month   Yes          1-31              * / , - L W
Month          Yes          1-12 or JAN-DEC   * / , -
Day of week    Yes          0-6 or SUN-SAT    * / , - L #
Year           No           1970–2099         * / , -

Upvotes: 0

Related Questions