summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2013-07-24 11:17:12 +0200
committerAndre Lorbach <alorbach@adiscon.com>2013-07-24 11:17:12 +0200
commit96ecc8bff7dab0043ec1ebec4c44a682bed02ca8 (patch)
treeaaa27247c8e5c52171628f4134aff213dd6f5de1
parent682975fe039f71f81c06f17c984fd3f3f263e9e7 (diff)
parent372c7264a598e72f6b9e8f734c9ea6a4a9427c8b (diff)
downloadrsyslog-96ecc8bff7dab0043ec1ebec4c44a682bed02ca8.tar.gz
rsyslog-96ecc8bff7dab0043ec1ebec4c44a682bed02ca8.tar.bz2
rsyslog-96ecc8bff7dab0043ec1ebec4c44a682bed02ca8.zip
Merge branch 'v7-stable'
-rw-r--r--plugins/omelasticsearch/omelasticsearch.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c
index 5c53ba19..aea8e321 100644
--- a/plugins/omelasticsearch/omelasticsearch.c
+++ b/plugins/omelasticsearch/omelasticsearch.c
@@ -613,8 +613,11 @@ curlPost(instanceData *pData, uchar *message, int msglen, uchar **tpls)
break;
}
- pData->reply[pData->replyLen] = '\0'; /* byte has been reserved in malloc */
- DBGPRINTF("omelasticsearch: es reply: '%s'\n", pData->reply);
+ DBGPRINTF("omelasticsearch: pData replyLen = '%d'\n", pData->replyLen);
+ if (pData->replyLen > 0) {
+ pData->reply[pData->replyLen] = '\0'; /* Append 0 Byte if replyLen is above 0 - byte has been reserved in malloc */
+ }
+ DBGPRINTF("omelasticsearch: pData reply: '%s'\n", pData->reply);
CHKiRet(checkResult(pData, message));
finalize_it:
@@ -648,12 +651,17 @@ ENDdoAction
BEGINendTransaction
- char *cstr;
+ char *cstr = NULL;
CODESTARTendTransaction
dbgprintf("omelasticsearch: endTransaction init\n");
- cstr = es_str2cstr(pData->batch.data, NULL);
- dbgprintf("omelasticsearch: endTransaction, batch: '%s'\n", cstr);
- CHKiRet(curlPost(pData, (uchar*) cstr, strlen(cstr), NULL));
+ /* End Transaction only if batch data is not empty */
+ if (pData->batch.data != NULL ) {
+ cstr = es_str2cstr(pData->batch.data, NULL);
+ dbgprintf("omelasticsearch: endTransaction, batch: '%s'\n", cstr);
+ CHKiRet(curlPost(pData, (uchar*) cstr, strlen(cstr), NULL));
+ }
+ else
+ dbgprintf("omelasticsearch: endTransaction, pData->batch.data is NULL, nothing to send. \n");
finalize_it:
free(cstr);
dbgprintf("omelasticsearch: endTransaction done with %d\n", iRet);