diff options
author | Michael Biebl <biebl@debian.org> | 2014-09-26 23:40:38 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2014-09-26 23:40:38 +0200 |
commit | 7bfd178d59a2c706d46092d745b54c61403cb44a (patch) | |
tree | fe5db3a861d09953408ad79a21318eda3afed7de /plugins/omelasticsearch | |
parent | 1dfcd909d90f6fad4a612b6fd998d7473a9da399 (diff) | |
download | rsyslog-upstream.tar.gz |
Imported Upstream version 8.4.1upstream/8.4.1upstream
Diffstat (limited to 'plugins/omelasticsearch')
-rw-r--r-- | plugins/omelasticsearch/omelasticsearch.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c index 9a33f85..68fb3c1 100644 --- a/plugins/omelasticsearch/omelasticsearch.c +++ b/plugins/omelasticsearch/omelasticsearch.c @@ -577,10 +577,10 @@ DBGPRINTF("omelasticsearch: %d items in reply\n", numitems); "cannot obtain 'create' item for #%d\n", i); ABORT_FINALIZE(RS_RET_DATAFAIL); } - ok = cJSON_GetObjectItem(create, "ok"); - if(ok == NULL || ok->type != cJSON_True) { + ok = cJSON_GetObjectItem(create, "status"); + if(ok == NULL || ok->type != cJSON_Number || ok->valueint < 0 || ok->valueint > 299) { DBGPRINTF("omelasticsearch: error in elasticsearch reply: " - "item %d, prop ok (%p) not ok\n", i, ok); + "item %d, status is %d\n", i, ok->valueint); ABORT_FINALIZE(RS_RET_DATAFAIL); } } @@ -594,7 +594,7 @@ static inline rsRetVal checkResult(wrkrInstanceData_t *pWrkrData, uchar *reqmsg) { cJSON *root; - cJSON *ok; + cJSON *status; DEFiRet; root = cJSON_Parse(pWrkrData->reply); @@ -606,8 +606,10 @@ checkResult(wrkrInstanceData_t *pWrkrData, uchar *reqmsg) if(pWrkrData->pData->bulkmode) { iRet = checkResultBulkmode(pWrkrData, root); } else { - ok = cJSON_GetObjectItem(root, "ok"); - if(ok == NULL || ok->type != cJSON_True) { + status = cJSON_GetObjectItem(root, "status"); + /* as far as we know, no "status" means all went well */ + if(status != NULL && + (status->type == cJSON_Number || status->valueint >= 0 || status->valueint <= 299)) { iRet = RS_RET_DATAFAIL; } } |