Unable to add content in email body with summary_table_fields
@Qmando
I'm using the below conditions to alert the email output in summary table field format. In the email output body, I would like to add some content. I tried to add the content next to the alert_text: | but it's not working. Are there any options to add some content in the email body with summary_field?
alert_text_type: alert_text_only
alert_text: |
summary_table_fields:
- srx-source-address
- srx-destination-address
- srx-destination-port
Expected Email body output
alert_text: |
Do you have actual text? You're adding an empty string.
@Qmando
I'm trying to add the test next to alert_text: | as shown below. But it is not working as expected. The text is getting appended at the bottom of the email. Attached Screenshot for reference.
Just an FYI I'm using type: cardinality
alert_text_type: alert_text_only
alert_text: |
This is a test email
summary_table_fields:
- srx-source-address
- srx-destination-address
- srx-destination-port
Here's the function where this text is generated:
https://github.com/Yelp/elastalert/blob/master/elastalert/alerts.py#L239
You could move self.get_aggregation_summary_text(matches) to the end of the function to make the alert_text appear first, though, it will still contain duplicates.
@Qmando
Thanks for the update. I see that for the summary_table_fields it prints the code line 257 from alerts.py. I would like to know is there any options to put the content of the alert_subject: to the email body?
I have uploaded the screenshot for reference.
255 # Include a count aggregation so that we can see at a glance how many of each aggregation_key were encountered
256 summary_table_fields_with_count = summary_table_fields + ['count']
257 text += "Aggregation resulted in the following data for summary_table_fields ==>{0}:\n\n".format(
258 summary_table_fields_with_count
259 )