opensearch-project / logstash-output-opensearch

A Logstash plugin that sends event data to a OpenSearch clusters and stores as an index.
https://opensearch.org/docs/latest/clients/logstash/index/
Apache License 2.0
107 stars 80 forks source link

Add detail reported with 400 errors #251

Open dblock opened 7 months ago

dblock commented 7 months ago

Is your feature request related to a problem? Please describe.

Coming from https://github.com/opensearch-project/logstash-output-opensearch/issues/227 and https://github.com/opensearch-project/logstash-output-opensearch/issues/249 the error in the output is not helpful.

[Ruby-0-Thread-10: /usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-output-opensearch-2.0.2-java/lib/logstash/plugin_mixins/opensearch/common.rb:77]
opensearch - Failed to install template {:message=>"Got response code '400' contacting OpenSearch at URL '[https://xxxx:443/_template/logstash](https://xxxx/_template/logstash)'",
:exception=>LogStash::Outputs::OpenSearch::HttpClient::Pool::BadResponseCodeError,
:backtrace=>["/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-output-opensearc ...

Describe the solution you'd like The error should contain the JSON body returned from the server so that it can be actioned.