# Send alert only if the error has http status code 500

**URL:** <https://discuss.elastic.co/t/send-alert-only-if-the-error-has-http-status-code-500/212689>\
**Category:** APM\
**Created:** [December 20, 2019, 4:44pm UTC](https://discuss.elastic.co/t/send-alert-only-if-the-error-has-http-status-code-500/212689 "2019-12-20T16:44:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edgar\_Peixoto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edgar_peixoto/32/58987_2.png) [@Edgar\_Peixoto](https://discuss.elastic.co/u/Edgar_Peixoto)\
**Post date:** [December 20, 2019, 4:44pm UTC](https://discuss.elastic.co/t/send-alert-only-if-the-error-has-http-status-code-500/212689/1 "2019-12-20T16:44:59Z")

</div>

I can send error alerts to a slack channel when an Java application send an error to APM. But I want to send only errors with status code 500.

I tried to put the following in the bool filter but now the alert does not send anything at all. I also tried to use **http.response.status\_code** with the same result.

```auto
{
  "term": {
    "context.response.status_code": 500
  }
}

```

I am using Elastic Cloud. Everything is in 7.5.1 version.

---

<div class="post-metadata">

**Author:** ![Edgar\_Peixoto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edgar_peixoto/32/58987_2.png) [@Edgar\_Peixoto](https://discuss.elastic.co/u/Edgar_Peixoto)\
**Post date:** [December 20, 2019, 8:58pm UTC](https://discuss.elastic.co/t/send-alert-only-if-the-error-has-http-status-code-500/212689/2 "2019-12-20T20:58:58Z")

</div>

I solved using:

```auto
{
  "term": {
    "http.response.status_code": "500"
  }
}

```

---

<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:** [January 10, 2020, 4:59pm UTC](https://discuss.elastic.co/t/send-alert-only-if-the-error-has-http-status-code-500/212689/3 "2020-01-10T16:59:01Z")

</div>

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