# How to get e-mail notification with log file path og log file hostname

**URL:** https://discuss.elastic.co/t/how-to-get-e-mail-notification-with-log-file-path-og-log-file-hostname/283890
**Category:** Kibana
**Tags:** elastic-stack-alerting
**Created:** [September 10, 2021, 1:43pm UTC](https://discuss.elastic.co/t/how-to-get-e-mail-notification-with-log-file-path-og-log-file-hostname/283890 "2021-09-10T13:43:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![amiraliw](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@amiraliw](https://discuss.elastic.co/u/amiraliw)
#### Post date: [September 10, 2021, 1:43pm UTC](https://discuss.elastic.co/t/how-to-get-e-mail-notification-with-log-file-path-og-log-file-hostname/283890/1 "2021-09-10T13:43:22Z")

</div>

Hi  
I am very new in elasticsearch and kibana.  
I have elasticsearch and kibana on the same on premise server. And filebeat agents are installed on several other servers (on premise). These agents send logs to elasticsearch. (There is no logstash)  
How I can get an e-mail notification when some specific string like "error" or "warning" is logged?  
Since there are several log files, I need the log file path, the log file server and the message which contains that specific string in the e-mail.

I tried to create log threshold and Elasticsearch query but I did not get the mentioned informations in e-mail. I dont know if I did correctly.

---

<div class="post-metadata">

### Author: ![ying.mao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ying.mao/32/88151_2.png) [@ying.mao](https://discuss.elastic.co/u/ying.mao)
#### Post date: [September 27, 2021, 12:40pm UTC](https://discuss.elastic.co/t/how-to-get-e-mail-notification-with-log-file-path-og-log-file-hostname/283890/2 "2021-09-27T12:40:30Z")

</div>

Hi @amiraliw! I believe you should be able to get this information with the Elasticsearch query rule, which allows you to access the matching documents inside the [context.hits action variable.](https://www.elastic.co/guide/en/kibana/current/rule-type-es-query.html#_add_action_variables_2). The docs give an example of how you would access the fields inside context.hits but if you need additional guidance, please provide a sample document and a sample rule configuration. Thank you!

---

<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: [October 25, 2021, 12:41pm UTC](https://discuss.elastic.co/t/how-to-get-e-mail-notification-with-log-file-path-og-log-file-hostname/283890/3 "2021-10-25T12:41:13Z")

</div>

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