summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-05-28 15:14:16 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-05-28 15:14:16 +0200
commit0314f370a4c15ce2190febfccee6664ecccab788 (patch)
tree2f96ecf97a388ebdf5a6eb78fb1788de70bec7fd /plugins
parent5f85909b17920172121d2ff8367c8185623f1409 (diff)
downloadrsyslog-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.c11
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);