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 #10000 5ensure_elasticsearch_ready 6 7init_elasticsearch 8 9generate_conf 10add_conf ' 11template(name="tpl" type="string" string="{\"msgnum\":\"%msg:F,58:2%\"}") 12template(name="tpl2" type="string" string="%msg:F,58:2%\n") 13 14module(load="../plugins/omelasticsearch/.libs/omelasticsearch") 156c04c0689247ae05104113e37dcb5e2e3e356865 16if $msg contains "msgnum:" then { 17 action(type="omelasticsearch" 18 server="127.0.0.1" 19 serverport="19200" 20 template="tpl" 21 searchIndex="rsyslog_testbench" 22 action.resumeInterval="2" 23 action.resumeretrycount="1") 24 25 action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="tpl2" 26 action.execOnlyWhenPreviousIsSuspended="on") 27 28 # this action just to count processed messages 29 action(type="omfile" file="'$RSYSLOG_DYNNAME'.syncfile") 30} 31' 32startup 33injectmsg 0 $NUMMESSAGES 34wait_file_lines $RSYSLOG_DYNNAME.syncfile $NUMMESSAGES 35stop_elasticsearch 36./msleep 1000 37injectmsg $NUMMESSAGES 1 38wait_file_lines $RSYSLOG_DYNNAME.syncfile $((NUMMESSAGES + 1)) 39wait_queueempty 40injectmsg $(( NUMMESSAGES + 1 )) $NUMMESSAGES 41wait_file_lines $RSYSLOG_DYNNAME.syncfile $((NUMMESSAGES + 1 + NUMMESSAGES)) 42start_elasticsearch 43 44shutdown_when_empty 45wait_shutdown 46 47seq_check $(( NUMMESSAGES + 1 )) $(( NUMMESSAGES * 2 )) 48es_getdata $NUMMESSAGES 19200 49seq_check 0 $(( NUMMESSAGES - 1 )) 50exit_test 51