diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-05-28 15:14:16 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-05-28 15:14:16 +0200 |
commit | 0314f370a4c15ce2190febfccee6664ecccab788 (patch) | |
tree | 2f96ecf97a388ebdf5a6eb78fb1788de70bec7fd /plugins | |
parent | 5f85909b17920172121d2ff8367c8185623f1409 (diff) | |
download | rsyslog-0314f370a4c15ce2190febfccee6664ecccab788.tar.gz rsyslog-0314f370a4c15ce2190febfccee6664ecccab788.tar.xz rsyslog-0314f370a4c15ce2190febfccee6664ecccab788.zip |
omelasticsearch: dyn index&type now also supported in bulk mode
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/omelasticsearch/omelasticsearch.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c index 704c9950..a09851b1 100644 --- a/plugins/omelasticsearch/omelasticsearch.c +++ b/plugins/omelasticsearch/omelasticsearch.c @@ -241,18 +241,21 @@ buildBatch(instanceData *pData, uchar *message, uchar *tpl1, uchar *tpl2) { int length = strlen((char *)message); int r; + uchar *searchIndex; + uchar *searchType; DEFiRet; # define META_STRT "{\"index\":{\"_index\": \"" # define META_TYPE "\",\"_type\":\"" # define META_END "\"}}\n" #warning TODO: use dynamic index/type! + getIndexAndType(pData, tpl1, tpl2, &searchIndex, &searchType); r = es_addBuf(&pData->batch.data, META_STRT, sizeof(META_STRT)-1); - if(r == 0) r = es_addBuf(&pData->batch.data, (char*)pData->searchIndex, - ustrlen(pData->searchIndex)); + if(r == 0) r = es_addBuf(&pData->batch.data, (char*)searchIndex, + ustrlen(searchIndex)); if(r == 0) r = es_addBuf(&pData->batch.data, META_TYPE, sizeof(META_TYPE)-1); - if(r == 0) r = es_addBuf(&pData->batch.data, (char*)pData->searchType, - ustrlen(pData->searchType)); + if(r == 0) r = es_addBuf(&pData->batch.data, (char*)searchType, + ustrlen(searchType)); if(r == 0) r = es_addBuf(&pData->batch.data, META_END, sizeof(META_END)-1); if(r == 0) r = es_addBuf(&pData->batch.data, (char*)message, length); if(r == 0) r = es_addBuf(&pData->batch.data, "\n", sizeof("\n")-1); |