Merge pull request #7035 from Icinga/feature/es-content-type

Elasticsearch: Change Content-Type header to 'application/x-ndjson' for bulk streams
This commit is contained in:
Michael Friedrich 2019-03-20 10:49:54 +01:00 committed by GitHub
commit fc1070c92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,7 @@ This affects the following features:
* [OpenTsdb](09-object-types.md#objecttype-opentsdbwriter)
* [Perfdata](09-object-types.md#objecttype-perfdatawriter) (for PNP)
### Package Dependencies <a id="upgrading-to-2-11-package-dependencies"></a>
#### Removed: YAJL

View File

@ -456,7 +456,12 @@ void ElasticsearchWriter::SendRequest(const String& body)
/* Specify required headers by Elasticsearch. */
req.AddHeader("Accept", "application/json");
req.AddHeader("Content-Type", "application/json");
/* Use application/x-ndjson for bulk streams. While ES
* is able to handle application/json, the newline separator
* causes problems with Logstash (#6609).
*/
req.AddHeader("Content-Type", "application/x-ndjson");
/* Send authentication if configured. */
String username = GetUsername();