--

How to send an email alert with html format in ElastAlert.

For this use below key value, so that in alert_subject we could define the subject using basic html . Use a yml formatter for the code I gave.

email_format: html

Demo.yaml: |-
---
name: Demo
type: frequency
limit_execution: "0/15 * * * *"
index: wpng-httpd-perf-*
num_events: 1
timeframe:
minutes: 15
filter:
- query:
query_string:
query: "keytomatch.keyword:value to match"
alert:
- "email"
email_format: html
email:
- "john@gmail.com"
from_addr: "john@gmail.com"
alert_subject: "WARINING - ERROR detected value to match at {0}."
alert_subject_args:
- "@timestamp"
alert_text: "<h5> Hello Team,<br></br><br/><b> {0} ERROR event(s)</b> detected in last 15 minute. <br/><br>Hosts where errors are detected :</br> Host_Id is {1} <br></br><br></br> <br>Here are a few of those :</br><br> messages {2} </br><br> </br><br/><br>Please reach out to Kafka Support team in case of any queries.</br><br></br><br></br><br></br>Thanks<br/>NSOC </h5> "
alert_text_type: alert_text_only
alert_text_args:
- num_matches
- Host_Id
- message

--

--