1#!/bin/bash
2# This file is part of the rsyslog project, released under ASL 2.0
3. ${srcdir:=.}/diag.sh init
4export NUMMESSAGES=100
5export ES_DOWNLOAD=elasticsearch-6.0.0.tar.gz
6export ES_PORT=19200
7ensure_elasticsearch_ready
8
9init_elasticsearch
10generate_conf
11add_conf '
12template(name="tpl" type="string"
13	 string="{\"msgnum\":\"%msg:F,58:2%\"}")
14
15module(load="../plugins/omelasticsearch/.libs/omelasticsearch")
16:msg, contains, "msgnum:" action(type="omelasticsearch"
17				 template="tpl"
18				 serverport=`echo $ES_PORT`
19				 searchIndex="rsyslog_testbench"
20				 bulkmode="on")
21'
22startup_vg
23injectmsg
24wait_queueempty
25shutdown_when_empty
26wait_shutdown_vg
27es_getdata $NUMMESSAGES $ES_PORT
28seq_check
29exit_test
30