mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6219 from Icinga/feature/elasticsearch-6
Add support for Elasticsearch 6
This commit is contained in:
commit
e7374b48cf
|
@ -403,7 +403,7 @@ The check results include parsed performance data metrics if enabled.
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> Elasticsearch 5.x is required. This feature has been successfully tested with Elasticsearch 5.6.4.
|
||||
> Elasticsearch 5.x or 6.x are required. This feature has been successfully tested with Elasticsearch 5.6.7 and 6.2.3.
|
||||
|
||||
Enable the feature and restart Icinga 2.
|
||||
|
||||
|
@ -433,12 +433,12 @@ Metric values are stored like this:
|
|||
|
||||
The following characters are escaped in perfdata labels:
|
||||
|
||||
Character | Escaped character
|
||||
--------------|--------------------------
|
||||
whitespace | _
|
||||
\ | _
|
||||
/ | _
|
||||
:: | .
|
||||
Character | Escaped character
|
||||
------------|--------------------------
|
||||
whitespace | _
|
||||
\ | _
|
||||
/ | _
|
||||
:: | .
|
||||
|
||||
Note that perfdata labels may contain dots (`.`) allowing to
|
||||
add more subsequent levels inside the tree.
|
||||
|
|
|
@ -353,11 +353,10 @@ void ElasticsearchWriter::Enqueue(const String& type, const Dictionary::Ptr& fie
|
|||
String eventType = m_EventPrefix + type;
|
||||
fields->Set("type", eventType);
|
||||
|
||||
/* Every payload needs a line describing the index above.
|
||||
/* Every payload needs a line describing the index.
|
||||
* We do it this way to avoid problems with a near full queue.
|
||||
*/
|
||||
|
||||
String indexBody = R"({ "index" : { "_type" : ")" + eventType + "\" } }\n";
|
||||
String indexBody = "{\"index\": {} }\n";
|
||||
String fieldsBody = JsonEncode(fields);
|
||||
|
||||
Log(LogDebug, "ElasticsearchWriter")
|
||||
|
@ -419,6 +418,11 @@ void ElasticsearchWriter::SendRequest(const String& body)
|
|||
*/
|
||||
path.emplace_back(GetIndex() + "-" + Utility::FormatDateTime("%Y.%m.%d", Utility::GetTime()));
|
||||
|
||||
/* ES 6 removes multiple _type mappings: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html
|
||||
* Best practice is to statically define 'doc', as ES 5.X does not allow types starting with '_'.
|
||||
*/
|
||||
path.emplace_back("doc");
|
||||
|
||||
/* Use the bulk message format. */
|
||||
path.emplace_back("_bulk");
|
||||
|
||||
|
|
Loading…
Reference in New Issue