rsyslog/rsyslog-8.2102.0-rhbz2192955-es-2.patch
alakatos 2c51b22dd8 omelasticsearch: make compatible with elasticsearch>=8
add new action specific parameter esversion.major
  resolves: rhbz#2192955
2023-05-11 15:58:38 +02:00

44 lines
1.5 KiB
Diff

diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c
index 0808c6054e..ed9359732c 100644
--- a/plugins/omelasticsearch/omelasticsearch.c
+++ b/plugins/omelasticsearch/omelasticsearch.c
@@ -877,14 +877,6 @@ parseRequestAndResponseForContext(wrkrInstanceData_t *pWrkrData,fjson_object **p
int i;
int numitems;
fjson_object *items=NULL, *jo_errors = NULL;
- int errors = 0;
-
- if(fjson_object_object_get_ex(replyRoot, "errors", &jo_errors)) {
- errors = fjson_object_get_boolean(jo_errors);
- if (!errors && pWrkrData->pData->retryFailures) {
- return RS_RET_OK;
- }
- }
/*iterate over items*/
if(!fjson_object_object_get_ex(replyRoot, "items", &items)) {
@@ -897,6 +889,15 @@ parseRequestAndResponseForContext(wrkrInstanceData_t *pWrkrData,fjson_object **p
numitems = fjson_object_array_length(items);
+ int errors = 0;
+ if(fjson_object_object_get_ex(replyRoot, "errors", &jo_errors)) {
+ errors = fjson_object_get_boolean(jo_errors);
+ if (!errors && pWrkrData->pData->retryFailures) {
+ STATSCOUNTER_ADD(indexSuccess, mutIndexSuccess, numitems);
+ return RS_RET_OK;
+ }
+ }
+
if (reqmsg) {
DBGPRINTF("omelasticsearch: Entire request %s\n", reqmsg);
} else {
@@ -1267,6 +1268,7 @@ getDataRetryFailures(context *ctx,int itemStatus,char *request,char *response,
response);
}
}
+
need_free_omes = 0;
CHKiRet(msgAddJSON(msg, (uchar*)".omes", omes, 0, 0));
MsgSetRuleset(msg, ctx->retryRuleset);