# Need help with a 2XX HTTP code 400 Error

**URL:** https://discuss.elastic.co/t/need-help-with-a-2xx-http-code-400-error/252682
**Category:** Logstash
**Created:** [October 20, 2020, 12:46pm UTC](https://discuss.elastic.co/t/need-help-with-a-2xx-http-code-400-error/252682 "2020-10-20T12:46:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ratch54](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@Ratch54](https://discuss.elastic.co/u/Ratch54)
#### Post date: [October 20, 2020, 12:46pm UTC](https://discuss.elastic.co/t/need-help-with-a-2xx-http-code-400-error/252682/1 "2020-10-20T12:46:31Z")

</div>

I am receiving the [ERROR][logstash.outputs.http][HTTP Output Failure] Encountered non-2XX HTTP code 400 {:response\_code=\>400, :url"[https://some](https://some) url:8086/write?db=db", :event=\>%{host} %{message}, will\_retry=\>false

The configuration file is shown below:

```auto
input {
  tcp {
    id => "endpoint"
    type => 'endpoint'
    port => "9000"
    codec => "json"
    enable_metric => "false"
    ssl_enable => "false"
  }
}

filter {
  if [type] == "endpoint" {
    ruby {
      code => "
        dig = even.get('timeliness')
        process = dig['entries'][0]['label']
        diff = dig['entries'][0]['end'] - dig['entries'][0]['start']
        header = event.get('[header]')
        count = header['intercepts'].to_f
        event.set('process',process)
        event.set('process_time',diff)
        event.set('count',count)
        event.set('avg',(diff/count).round(2))
       "
       remove_field => ["timeliness"]
    }
    mutate {
      add_field => {"hostname" => "%{[header][hostname]}"}
      add_field => {"time" => "%{[header][timestamp]}"}
      remove_field => ["header", "uuid"]
    }
  }
}

output {
  if [type] == "endpoint" {
    http {
      http_method => "post"
      url => "https://some url:8086/write?db=db"
      format => "message"
      message => "endpoint,process=%{[process]},hostname=%{[hostname]}
      process_time= %{[process_time]},avg_time=%{[avg]},count=%{[count]} %{[time]}"
      truststore =? "location/of/trustore"
      trustore_password => "trust_store_password"
    }
  }
}

```

---

<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 17, 2020, 12:46pm UTC](https://discuss.elastic.co/t/need-help-with-a-2xx-http-code-400-error/252682/2 "2020-11-17T12:46:34Z")

</div>

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