# How to setup an alert which checks for a keyword

**URL:** https://forum.opensearch.org/t/how-to-setup-an-alert-which-checks-for-a-keyword/3083
**Category:** Alerting
**Created:** [June 16, 2020, 4:58pm UTC](https://forum.opensearch.org/t/how-to-setup-an-alert-which-checks-for-a-keyword/3083 "2020-06-16T16:58:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vrathore12](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@vrathore12](https://forum.opensearch.org/u/vrathore12)
#### Post date: [June 16, 2020, 4:58pm UTC](https://forum.opensearch.org/t/how-to-setup-an-alert-which-checks-for-a-keyword/3083/1 "2020-06-16T16:58:06Z")

</div>

I am trying to add an alert on Kibana. The destination is created but I am not able to understand how to create a monitor to check for this key “setException MongoDB Generic Error” and when the count is greater than 1. trigger alert.

I am selecting this options:

```auto
How do you want to define the monitor?: define using a visual graph
index? *
Time field? @timestamp

```

but I am not getting any field where I can enter the keyword.

Basically I am looking to set a monitor which checks and trigger alert whenever new logs comes which contains **setException MongoDB Generic Error** in the message

```auto
**Kibana version:** 6.4.2
filebeat: 6.3.2

```

---

<div class="post-metadata">

### Author: ![ftianli](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@ftianli](https://forum.opensearch.org/u/ftianli)
#### Post date: [July 8, 2020, 4:48pm UTC](https://forum.opensearch.org/t/how-to-setup-an-alert-which-checks-for-a-keyword/3083/2 "2020-07-08T16:48:04Z")

</div>

Hi Vikas,  
I think for your use case, you could use select “define using extraction query” to define the monitor, and it’s better for monitoring a text value. And then you could set a trigger if the specific text contains in the message.  
About setting the trigger:

1. You may need to enable the regular expressions in the ES cluster, by setting `script.painless.regex.enabled: true` in `elasticsearch.yml`. See here for detail: [Painless Examples | Painless Scripting Language [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/painless/6.8/painless-examples.html#modules-scripting-painless-regex)
2. Your trigger condition might be like this: `ctx.results[0].hits.hits[0]._source.error_message =~ /setException MongoDB Generic Error/` .

Tianli
