# Message ID in Alerts

**URL:** <https://community.graylog.org/t/message-id-in-alerts/19537>\
**Category:** Graylog Central (peer support)\
**Created:** [April 20, 2021, 7:03am UTC](https://community.graylog.org/t/message-id-in-alerts/19537 "2021-04-20T07:03:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wadimsewo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/wadimsewo/32/8424_2.png) [@wadimsewo](https://community.graylog.org/u/wadimsewo)\
**Post date:** [April 20, 2021, 7:03am UTC](https://community.graylog.org/t/message-id-in-alerts/19537/1 "2021-04-20T07:03:09Z")

</div>

Hello,

can someone tell me how to read graylog message ID in alerts template? We use Graylog 4 and unfortunately we could not find any info in the documentation.

A link to the message would be even better, of course. According to the documentation it should be ${event.id}. But with this no messages can be found.

Best regards,  
Wadim

---

<div class="post-metadata">

**Author:** ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)\
**Post date:** [April 21, 2021, 12:19am UTC](https://community.graylog.org/t/message-id-in-alerts/19537/2 "2021-04-21T00:19:59Z")

</div>

@wadimsewo  
Hello and welcome

Maybe I can help.

${event.id} is the message ID of the stored event/s. This is the ID in Alerts & Events.

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

${message.id} is the The message ID. This would be the one you use to find the message.

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

Example:  
Notification Template with Event ID and Message ID.  
.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/0/0ef5002875eea2dc4b9890d8630c0e19e858204e.png)

Notifcation Email received.

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

I hope helps.

---

<div class="post-metadata">

**Author:** ![wadimsewo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/wadimsewo/32/8424_2.png) [@wadimsewo](https://community.graylog.org/u/wadimsewo)\
**Post date:** [April 22, 2021, 5:50am UTC](https://community.graylog.org/t/message-id-in-alerts/19537/3 "2021-04-22T05:50:08Z")

</div>

Hi @gsmith,  
thanks for your reply.

I already read about ${message.id} but unfortunately it does not work. The value is completely empty.  
This is my template:

 ![Bildschirmfoto 2021-04-22 um 07.48.55](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/a/ab0630dacb7698537ea15ac675da61bf6bc3c2a4.png)

And I receive this email:

![Bildschirmfoto 2021-04-22 um 07.48.27](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/5/59fd129fb5b5538d4e782e8bf98d68f6b1fba811.png)

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [April 22, 2021, 10:20am UTC](https://community.graylog.org/t/message-id-in-alerts/19537/4 "2021-04-22T10:20:19Z")

</div>

You can’t access `${message.id}` directly, you need to use inside loop foreach:

```auto
${foreach backlog message}
ID: ${message.id}
${end}

```

---

<div class="post-metadata">

**Author:** ![wadimsewo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/wadimsewo/32/8424_2.png) [@wadimsewo](https://community.graylog.org/u/wadimsewo)\
**Post date:** [April 22, 2021, 11:08am UTC](https://community.graylog.org/t/message-id-in-alerts/19537/5 "2021-04-22T11:08:34Z")

</div>

Hi @shoothub,

I tried it out, but still no message ID 😕

My template:

![Bildschirmfoto 2021-04-22 um 13.05.55](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/0/0e7cc47bbd4cfeb2d851fd51e44992fff66a502a.png)

E-Mail:

![Bildschirmfoto 2021-04-22 um 13.06.37](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/1/1ca46616db10d04679d748e6ba442c21a7349d76.png)

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [April 22, 2021, 12:30pm UTC](https://community.graylog.org/t/message-id-in-alerts/19537/6 "2021-04-22T12:30:19Z")

</div>

Check if you have enabled `Message backlog` and setup to 1

---

<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:** [May 6, 2021, 9:25pm UTC](https://community.graylog.org/t/message-id-in-alerts/19537/8 "2021-05-06T21:25:48Z")

</div>

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