# Endpoint SIEM rule trigger execution "email"

**URL:** <https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836>\
**Category:** Elastic Security\
**Created:** [October 27, 2021, 5:13pm UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836 "2021-10-27T17:13:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PublicName](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@PublicName](https://discuss.elastic.co/u/PublicName)\
**Post date:** [October 27, 2021, 5:13pm UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836/1 "2021-10-27T17:13:56Z")

</div>

Simple idea and question for this one. SIEM rules are really nice but I'll be honest I don't keep the Alerts tabs open 24x7. I do have to sleep at some point in life...

Setting the Endpoint Security rule to perform a task on execution works but it rather limited it want it send. Using `context.hits` does not trigger as expected.

```auto
{{date}}Rule {{context.rule.name}}

{{#context.hits}}
  User: {{_source.user.name}}
  Machine Name: {{_source.host.name}}
  Timestamp: {{_source.context.date}}
  File Path: {{_source.file.path.text}}
  File Name: {{_source.file.name}}
  File SHA256 Hash: {{_source.file.hash.sha256}}
{{/context.hits}}

```

What I end up with is this:

```auto
2021-10-27T14:37:28.584ZRule Endpoint Security

"Some text I put in to test"

--

This message was sent by Kibana.

```

Nothing is appended to the event so the alert is useless at a glance. Do the rules use another setting then normal alerts?

---

<div class="post-metadata">

**Author:** ![christos.nasikas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christos.nasikas/32/45611_2.png) [@christos.nasikas](https://discuss.elastic.co/u/christos.nasikas)\
**Post date:** [November 1, 2021, 10:57am UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836/2 "2021-11-01T10:57:19Z")

</div>

Hi @PublicName,

Which version of Kibana do you use? I do not see a `context.hits` context variable. You can use the `context.alerts` variable. Is that available to you? You can access context variables from the "add rule variable" icon:

 ![Screenshot 2021-11-01 at 12.50.53 PM](https://us1.discourse-cdn.com/elastic/original/3X/2/4/242f19a09d13795b76ef5f7028b2d16bc0c162ed.png)

Using the `context.alerts`

```auto
{{#context.alerts}}
Machine Name: {{host.name}}
File Path: {{file.path.text}}
File Name: {{file.name}}
File SHA256 Hash: {{file.hash.sha256}}
{{/context.alerts}}

```

Best,  
Christos

---

<div class="post-metadata">

**Author:** ![PublicName](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@PublicName](https://discuss.elastic.co/u/PublicName)\
**Post date:** [November 1, 2021, 3:54pm UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836/3 "2021-11-01T15:54:59Z")

</div>

7.15.

Thx much for some reason I was thinking it was a query with context.hit. I'll give the alerts another try and see if it triggers this time. Was using context.alerts in 7.13 and it was always blank as well.

---

<div class="post-metadata">

**Author:** ![christos.nasikas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christos.nasikas/32/45611_2.png) [@christos.nasikas](https://discuss.elastic.co/u/christos.nasikas)\
**Post date:** [November 1, 2021, 4:04pm UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836/4 "2021-11-01T16:04:30Z")

</div>

Ok! Let me know if that worked for your or if you need any help.

Best,  
Christos

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2021, 4:05pm UTC](https://discuss.elastic.co/t/endpoint-siem-rule-trigger-execution-email/287836/5 "2021-11-29T16:05:17Z")

</div>

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