# Email Alert sending separate emails for different messages

**URL:** https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577
**Category:** Graylog Central (peer support)
**Created:** [July 29, 2020, 8:25am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577 "2020-07-29T08:25:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![peaky10](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@peaky10](https://community.graylog.org/u/peaky10)
#### Post date: [July 29, 2020, 8:25am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/1 "2020-07-29T08:25:28Z")

</div>

_Using the Graylog version: 3.3.2_

I am using the below template for Graylog alerts and have not been receiving emails as expected.

```
--- [Event Definition] ---------------------------
Title: ${event_definition_title}
Description: ${event_definition_description}
Type: ${event_definition_type}
--- [Messages] -----------------------------------
${if backlog} ${foreach backlog message}
Response Code: ${message.fields.response_code} | HTTP_REFERRER: ${message.fields.http_referrer}
${end}${else}No Backlog${end}
--- [Event] --------------------------------------
Timestamp: ${event.timestamp}
Message: ${event.message}
Source: ${event.source}
--------------------------------------------------

```

While receiving email, I’m getting separate email for every message in backlog as below:

**First Email:**

```
--- [Event Definition] ---------------------------
Title: http referrer
Description: Http referrer with status code !=200
Type: aggregation-v1
--- [Messages] -----------------------------------

Response Code: 404 | HTTP_REFERRER: https://xxxx.xxx.xxxx/xxx

--- [Event] --------------------------------------
Timestamp: 2020-07-28T08:31:48.859Z
Message: http referrer
Source: e9ac8be01bcb
--------------------------------------------------

```

**Second Email:**

```
--- [Event Definition] ---------------------------
Title: http referrer
Description: Http referrer with status code !=200
Type: aggregation-v1
--- [Messages] -----------------------------------

Response Code: 502 | HTTP_REFERRER: https://xxxxx.xxxx/xxxx

--- [Event] --------------------------------------
Timestamp: 2020-07-28T09:01:05.465Z
Message: http referrer
Source: e9ac8be01bcb
--------------------------------------------------

```

**Third Email:**

```
--- [Event Definition] ---------------------------
Title: http referrer
Description: Http referrer with status code !=200
Type: aggregation-v1
--- [Messages] -----------------------------------

Response Code: 404 | HTTP_REFERRER: https://xxx.xxx.xxx.xxx/xxx

--- [Event] --------------------------------------
Timestamp: 2020-07-28T09:41:17.301Z
Message: http referrer
Source: e9ac8be01bcb
--------------------------------------------------

```

and so on.

I have been getting thousands of emails like this below:

![Screenshot](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/9/983b9b6c6604812746b9ec2ac1cab3373f224540.png)

I want to get all the backlog messages in a single email body, like below:

```
--- [Event Definition] ---------------------------
Title: http referrer
Description: Http referrer with status code !=200
Type: aggregation-v1
--- [Messages] -----------------------------------

Response Code: 404 | HTTP_REFERRER: https://xxxx.xxx.xxxx/xxx
Response Code: 502 | HTTP_REFERRER: https://xxxxx.xxxx/xxxx
Response Code: 404 | HTTP_REFERRER: https://xxx.xxx.xxx.xxx/xxx

--- [Event] --------------------------------------
Timestamp: 2020-07-28T08:31:48.859Z
Message: http referrer
Source: e9ac8be01bcb
--------------------------------------------------

```

Kindly guide me with the solution. Thanks!

---

<div class="post-metadata">

### Author: ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)
#### Post date: [July 29, 2020, 9:55am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/2 "2020-07-29T09:55:06Z")

</div>

how did you configure the events and alerst?

---

<div class="post-metadata">

### Author: ![peaky10](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@peaky10](https://community.graylog.org/u/peaky10)
#### Post date: [July 29, 2020, 10:23am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/3 "2020-07-29T10:23:13Z")

</div>

Took the screenshot of Summary:

 ![Screenshot from 2020-07-29 15-49-30](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/c/c227a0b8316b4c994dd3207a3432c37875561190.png)  
 ![Screenshot2](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/0/071b619b3c7202ddb85a4f0cd404e0770637f6ed.png)

I hope it helps in understanding the problem.

---

<div class="post-metadata">

### Author: ![peaky10](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@peaky10](https://community.graylog.org/u/peaky10)
#### Post date: [August 5, 2020, 10:39am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/4 "2020-08-05T10:39:01Z")

</div>

Hello @jan,  
Please help anything I can try to make this work?

Thanks!

---

<div class="post-metadata">

### Author: ![marick](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/marick/32/1418_2.png) [@marick](https://community.graylog.org/u/marick)
#### Post date: [August 13, 2020, 8:10am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/5 "2020-08-13T08:10:17Z")

</div>

> [@peaky10](#):
>
> s below:

Guys thank you for great job!

I have the same problem. One email for every message.  
Graylog server 3.3.3  
elasticsearch 6.8.11  
Oracle linux 7.8

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/3/3eb349a345bc212b6628447fc23a0a00e60a39ee.png)

---

<div class="post-metadata">

### Author: ![marick](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/marick/32/1418_2.png) [@marick](https://community.graylog.org/u/marick)
#### Post date: [August 19, 2020, 11:46am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/6 "2020-08-19T11:46:35Z")

</div>

How many Events will Filter & Aggregation create?

The Filter & Aggregation Condition will generate different number of Events, depending on how it is configured:

- **Filter:** One Event per message matching the filter
- **Aggregation without groups:** One Event every time the aggregation result satisfies the condition
- **Aggregation with groups:** One Event per group whose aggregation result satisfies the condition

So I grouped by field ( beats\_type): Example: count(beats\_type) **\>** 1  
If I group by **message** I get the following error:

“Fielddata is disabled on text fields by default. Set fielddata=true on [full\_message] in order to load fielddata in memory by uninverting the inverted index. Note  
that this can however use significant memory. Alternatively use a keyword field instead., errorDetails=[Fielddata is disabled on text fields by default. Set fiel  
ddata=true on [full\_message] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternativ  
ely use a keyword field instead.]}  
at org.graylog2.indexer.cluster.jest.JestUtils.specificException(JestUtils.java:110)  
at org.graylog.plugins.views.search.elasticsearch.ElasticsearchBackend.doRun(ElasticsearchBackend.java:263)  
at org.graylog.plugins.views.search.elasticsearch.ElasticsearchBackend.doRun(ElasticsearchBackend.java:74)”

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/6/66a7cdab5008fd4f2baa9df3e08945d2ffa89e5c.png)

Now I receive 1 mail for 10 messages if they come in 5 seconds interval.  
I hope I’m doing it correctly 🙂  
Hope it helps! 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)
#### Post date: [September 2, 2020, 11:46am UTC](https://community.graylog.org/t/email-alert-sending-separate-emails-for-different-messages/16577/7 "2020-09-02T11:46:36Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
