# Error with http-plugin output Encountered non-2xx HTTP code 400

**URL:** https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215
**Category:** Logstash
**Created:** [November 29, 2023, 10:19am UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215 "2023-11-29T10:19:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bilal\_adoui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilal_adoui/32/128204_2.png) [@bilal\_adoui](https://discuss.elastic.co/u/bilal_adoui)
#### Post date: [November 29, 2023, 10:19am UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215/1 "2023-11-29T10:19:50Z")

</div>

Hi,

I am trying to send a notification from Logstash to our Teams channel, using HTTP plugin however I am getting :

```auto
[HTTP Output Failure] Encountered non-2xx HTTP code 400 {:response_code=>400

```

and this is my output configuration:

```auto
output {
  # sent notification from logstash output to Teams channel
  if [loglevel] == "ERROR" and [message] !~ /Requested number range/ {
    http {
      url => ""
      http_method => "post"
      format => "json"
      content_type => "application/json"
      message => {
        "text" => "Error log detected Here is the event that triggered this alert"
      }
      proxy => ""
    }

    stdout {
      codec => json_lines
    }
  }

}

```

---

<div class="post-metadata">

### Author: ![Bassem\_Ben\_Jemaa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bassem_ben_jemaa/32/130282_2.png) [@Bassem\_Ben\_Jemaa](https://discuss.elastic.co/u/Bassem_Ben_Jemaa)
#### Post date: [December 24, 2023, 7:50am UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215/2 "2023-12-24T07:50:48Z")

</div>

Hi @bilal_adoui

I am facing the same issue. Did you manage to fix it ?

Best, B.

---

<div class="post-metadata">

### Author: ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)
#### Post date: [December 24, 2023, 2:31pm UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215/3 "2023-12-24T14:31:20Z")

</div>

> [@bilal\_adoui](#):
>
> Hi,
> 
> I am trying to send a notification from Logstash to our Teams channel, using HTTP plugin however I am getting :
> 
> ```auto
> [HTTP Output Failure] Encountered non-2xx HTTP code 400 {:response_code=>400
> 
> ```
> 
> and this is my output configuration:
> 
> ```auto
> output {
> # sent notification from logstash output to Teams channel
> if [loglevel] == "ERROR" and [message] !~ /Requested number range/ {
> http {
> url => ""
> http_method => "post"
> format => "json"
> content_type => "application/json"
> message => {
> "text" => "Error log detected Here is the event that triggered this alert"
> }
> proxy => ""
> }
> 
> stdout {
> codec => json_lines
> }
> }
> 
> }
> 
> ```

Hi,

Try changing your `message` field to something like this:

```auto
message => '{ "text": "Error log detected. Here is the event that triggered this alert." }'

```

Regards

---

<div class="post-metadata">

### Author: ![bilal\_adoui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilal_adoui/32/128204_2.png) [@bilal\_adoui](https://discuss.elastic.co/u/bilal_adoui)
#### Post date: [December 25, 2023, 10:27am UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215/4 "2023-12-25T10:27:04Z")

</div>

Unfortunately not yet, seems it's a bug.

---

<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 22, 2024, 10:27am UTC](https://discuss.elastic.co/t/error-with-http-plugin-output-encountered-non-2xx-http-code-400/348215/5 "2024-01-22T10:27:52Z")

</div>

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