diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 25 | ||||
-rw-r--r-- | tests/chkseq.c | 29 | ||||
-rwxr-xr-x | tests/daqueue-persist.sh | 1 | ||||
-rwxr-xr-x | tests/diag.sh | 6 | ||||
-rwxr-xr-x | tests/diskqueue.sh | 1 | ||||
-rwxr-xr-x | tests/global_vars.sh | 15 | ||||
-rwxr-xr-x | tests/mmpstrucdata.sh | 12 | ||||
-rwxr-xr-x | tests/rfc5424parser.sh | 12 | ||||
-rwxr-xr-x | tests/rs_optimizer_pri.sh | 17 | ||||
-rwxr-xr-x | tests/rulesetmultiqueue-v6.sh | 33 | ||||
-rwxr-xr-x | tests/stop.sh | 12 | ||||
-rw-r--r-- | tests/tcpflood.c | 28 | ||||
-rw-r--r-- | tests/testsuites/global_vars.conf | 17 | ||||
-rw-r--r-- | tests/testsuites/mmpstrucdata.conf | 12 | ||||
-rw-r--r-- | tests/testsuites/rfc5424parser.conf | 10 | ||||
-rw-r--r-- | tests/testsuites/rs_optimizer_pri.conf | 8 | ||||
-rw-r--r-- | tests/testsuites/rulesetmultiqueue-v6.conf | 34 | ||||
-rw-r--r-- | tests/testsuites/stop-localvar.conf | 8 | ||||
-rw-r--r-- | tests/testsuites/stop.conf | 11 |
19 files changed, 273 insertions, 18 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index fd1dbce1..5232e3ef 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,7 +7,10 @@ TESTS = $(TESTRUNS) if ENABLE_IMDIAG TESTS += \ stop-localvar.sh \ + stop-msgvar.sh \ + rfc5424parser.sh \ arrayqueue.sh \ + global_vars.sh \ da-mainmsg-q.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -15,6 +18,7 @@ TESTS += \ diskqueue.sh \ diskqueue-fsync.sh \ rulesetmultiqueue.sh \ + rulesetmultiqueue-v6.sh \ manytcp.sh \ rsf_getenv.sh \ imtcp_conndrop.sh \ @@ -58,6 +62,7 @@ TESTS += \ discard-rptdmsg.sh \ discard-allmark.sh \ discard.sh \ + stop.sh \ failover-async.sh \ failover-double.sh \ failover-basic.sh \ @@ -72,6 +77,7 @@ TESTS += \ rscript_prifilt.sh \ rscript_optimizer1.sh \ rscript_ruleset_call.sh \ + rs_optimizer_pri.sh \ cee_simple.sh \ cee_diskqueue.sh \ incltest.sh \ @@ -118,6 +124,11 @@ TESTS += \ imptcp_conndrop.sh endif +if ENABLE_MMPSTRUCDATA +TESTS += \ + mmpstrucdata.sh +endif + if ENABLE_GNUTLS # TODO: re-enable in newer version #TESTS += \ @@ -290,8 +301,18 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rscript_stop.conf \ rscript_stop2.sh \ testsuites/rscript_stop2.conf \ + stop.sh \ + testsuites/stop.conf \ stop-localvar.sh \ testsuites/stop-localvar.conf \ + stop-msgvar.sh \ + testsuites/stop-msgvar.conf \ + global_vars.sh \ + testsuites/global_vars.conf \ + rfc5424parser.sh \ + testsuites/rfc5424parser.conf \ + rs_optimizer_pri.sh \ + testsuites/rs_optimizer_pri.conf \ rscript_prifilt.sh \ testsuites/rscript_prifilt.conf \ rscript_optimizer1.sh \ @@ -463,6 +484,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/master.nolimittag \ rulesetmultiqueue.sh \ testsuites/rulesetmultiqueue.conf \ + rulesetmultiqueue-v6.sh \ + testsuites/rulesetmultiqueue-v6.conf \ omruleset.sh \ testsuites/omruleset.conf \ omruleset-queue.sh \ @@ -514,6 +537,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ mysql-asyn.sh \ mysql-asyn-vg.sh \ testsuites/mysql-asyn.conf \ + mmpstrucdata.sh \ + testsuites/mmpstrucdata.conf \ cfg.sh # TODO: re-enable diff --git a/tests/chkseq.c b/tests/chkseq.c index bea9f83a..bd8597e8 100644 --- a/tests/chkseq.c +++ b/tests/chkseq.c @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) int reachedEOF; int edLen; /* length of extra data */ static char edBuf[500*1024]; /* buffer for extra data (pretty large to be on the save side...) */ + static char ioBuf[sizeof(edBuf)+1024]; char *file = NULL; while((opt = getopt(argc, argv, "e:f:ds:vE")) != EOF) { @@ -103,14 +104,22 @@ int main(int argc, char *argv[]) for(i = start ; i < end+1 ; ++i) { if(bHaveExtraData) { - scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + } if(edLen != (int) strlen(edBuf)) { printf("extra data length specified %d, but actually is %ld in record %d\n", edLen, (long) strlen(edBuf), i); exit(1); } } else { - scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0; + } } if(!scanfOK) { printf("scanf error in index i=%d\n", i); @@ -132,9 +141,11 @@ int main(int argc, char *argv[]) exit(1); } - if(feof(fp)) { + int c = getc(fp); + if(c == EOF) { reachedEOF = 1; } else { + ungetc(c, fp); /* if duplicates are permitted, we need to do a final check if we have duplicates at the * end of file. */ @@ -142,14 +153,22 @@ int main(int argc, char *argv[]) i = end; while(!feof(fp)) { if(bHaveExtraData) { - scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + } if(edLen != (int) strlen(edBuf)) { printf("extra data length specified %d, but actually is %ld in record %d\n", edLen, (long) strlen(edBuf), i); exit(1); } } else { - scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0; + } } if(val != i) { diff --git a/tests/daqueue-persist.sh b/tests/daqueue-persist.sh index feb2a347..0781a7dc 100755 --- a/tests/daqueue-persist.sh +++ b/tests/daqueue-persist.sh @@ -2,6 +2,7 @@ # to carry out multiple tests with different queue modes # added 2009-05-27 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== echo \[daqueue-persist.sh\]: test data persisting at shutdown source $srcdir/daqueue-persist-drvr.sh LinkedList source $srcdir/daqueue-persist-drvr.sh FixedArray diff --git a/tests/diag.sh b/tests/diag.sh index 7883d93b..71d62111 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -142,7 +142,7 @@ case $1 in 'seq-check') # do the usual sequence check to see if everything was properly received. $2 is the instance. rm -f work cp rsyslog.out.log work-presort - sort < rsyslog.out.log > work + sort -g < rsyslog.out.log > work # $4... are just to have the abilit to pass in more options... # add -v to chkseq if you need more verbose output ./chkseq -fwork -s$2 -e$3 $4 $5 $6 $7 @@ -155,7 +155,7 @@ case $1 in # a duplicateof seq-check, but we could not change its calling conventions without # breaking a lot of exitings test cases, so we preferred to duplicate the code here. rm -f work2 - sort < rsyslog2.out.log > work2 + sort -g < rsyslog2.out.log > work2 # $4... are just to have the abilit to pass in more options... # add -v to chkseq if you need more verbose output ./chkseq -fwork2 -s$2 -e$3 $4 $5 $6 $7 @@ -168,7 +168,7 @@ case $1 in 'gzip-seq-check') # do the usual sequence check, but for gzip files rm -f work ls -l rsyslog.out.log - gunzip < rsyslog.out.log | sort > work + gunzip < rsyslog.out.log | sort -g > work ls -l work # $4... are just to have the abilit to pass in more options... ./chkseq -fwork -v -s$2 -e$3 $4 $5 $6 $7 diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh index b871e9eb..853a836a 100755 --- a/tests/diskqueue.sh +++ b/tests/diskqueue.sh @@ -5,6 +5,7 @@ # added 2009-04-17 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: +echo =============================================================================== echo \[diskqueue.sh\]: testing queue disk-only mode # uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" diff --git a/tests/global_vars.sh b/tests/global_vars.sh new file mode 100755 index 00000000..5c6c579e --- /dev/null +++ b/tests/global_vars.sh @@ -0,0 +1,15 @@ +# Test for global variables +# added 2013-11-18 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[global_vars.sh\]: testing global variable support +source $srcdir/diag.sh init +source $srcdir/diag.sh startup global_vars.conf + +# 40000 messages should be enough +source $srcdir/diag.sh injectmsg 0 40000 + +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 39999 +source $srcdir/diag.sh exit diff --git a/tests/mmpstrucdata.sh b/tests/mmpstrucdata.sh new file mode 100755 index 00000000..62b6ba96 --- /dev/null +++ b/tests/mmpstrucdata.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-22 +echo =============================================================================== +echo \[mmpstrucdata.sh\]: testing mmpstrucdata +source $srcdir/diag.sh init +source $srcdir/diag.sh startup mmpstrucdata.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 -y +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/rfc5424parser.sh b/tests/rfc5424parser.sh new file mode 100755 index 00000000..3f5be497 --- /dev/null +++ b/tests/rfc5424parser.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-22 +echo =============================================================================== +echo \[rfc5424parser.sh\]: testing mmpstrucdata +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rfc5424parser.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 -y +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/rs_optimizer_pri.sh b/tests/rs_optimizer_pri.sh new file mode 100755 index 00000000..4d6e4637 --- /dev/null +++ b/tests/rs_optimizer_pri.sh @@ -0,0 +1,17 @@ +# Test for the RainerScript optimizer, folding of +# syslogfacility/priority-text to prifilt. Unfortunately, we cannot yet +# automatically detect if the optimizer does not correctly fold, but we +# can at least detect if it segfaults or otherwise creates incorrect code. +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-20 +echo =============================================================================== +echo \[rs_optimizer_pri.sh\]: testing RainerScript PRI optimizer +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rs_optimizer_pri.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 # correct facility +source $srcdir/diag.sh tcpflood -m100 -P175 # incorrect facility --> must be ignored +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/rulesetmultiqueue-v6.sh b/tests/rulesetmultiqueue-v6.sh new file mode 100755 index 00000000..21166fe1 --- /dev/null +++ b/tests/rulesetmultiqueue-v6.sh @@ -0,0 +1,33 @@ +# Test for disk-only queue mode with v6+ config +# This tests defines three rulesets, each one with its own queue. Then, it +# sends data to them and checks the outcome. Note that we do need to +# use some custom code as the test driver framework does not (yet?) +# support multi-output-file operations. +# added 2013-11-14 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[rulesetmultiqueu.sh\]: testing multiple queues via rulesets +source $srcdir/diag.sh init +rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log +source $srcdir/diag.sh startup rulesetmultiqueue-v6.conf +source $srcdir/diag.sh wait-startup +# now fill the three files (a bit sequentially, but they should +# still get their share of concurrency - to increase the chance +# we use three connections per set). +source $srcdir/diag.sh tcpflood -c3 -p13514 -m20000 -i0 +source $srcdir/diag.sh tcpflood -c3 -p13515 -m20000 -i20000 +source $srcdir/diag.sh tcpflood -c3 -p13516 -m20000 -i40000 + +# in this version of the imdiag, we do not have the capability to poll +# all queues for emptyness. So we do a sleep in the hopes that this will +# sufficiently drain the queues. This is race, but the best we currently +# can do... - rgerhards, 2009-11-05 +sleep 2 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +# now consolidate all logs into a single one so that we can use the +# regular check logic +cat rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 59999 +rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log +source $srcdir/diag.sh exit diff --git a/tests/stop.sh b/tests/stop.sh new file mode 100755 index 00000000..f3dcf993 --- /dev/null +++ b/tests/stop.sh @@ -0,0 +1,12 @@ +# Test for "stop" statement +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[stop.sh\]: testing stop statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup stop.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m10 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/tcpflood.c b/tests/tcpflood.c index b3cef2e0..f17363f2 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -48,13 +48,14 @@ * -b number of messages within a batch (default: 100,000,000 millions) * -Y use multiple threads, one per connection (which means 1 if one only connection * is configured!) + * -y use RFC5424 style test message * -z private key file for TLS mode * -Z cert (public key) file for TLS mode * -L loglevel to use for GnuTLS troubleshooting (0-off to 10-all, 0 default) * * Part of the testbench for rsyslog. * - * Copyright 2009, 2010 Rainer Gerhards and Adiscon GmbH. + * Copyright 2009, 2013 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -111,6 +112,7 @@ static int targetPort = 13514; static int numTargetPorts = 1; static int dynFileIDs = 0; static int extraDataLen = 0; /* amount of extra data to add to message */ +static int useRFC5424Format = 0; /* should the test message be in RFC5424 format? */ static int bRandomizeExtraData = 0; /* randomize amount of extra data added */ static int numMsgsToSend; /* number of messages to send */ static unsigned numConnections = 1; /* number of connections to create */ @@ -363,8 +365,14 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) snprintf(dynFileIDBuf, sizeof(dynFileIDBuf), "%d:", rand() % dynFileIDs); } if(extraDataLen == 0) { - *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", - msgPRI, dynFileIDBuf, msgNum, frameDelim); + if(useRFC5424Format) { + *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood " + "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c", + msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim); + } else { + *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", + msgPRI, dynFileIDBuf, msgNum, frameDelim); + } } else { if(bRandomizeExtraData) edLen = ((long) rand() + extraDataLen) % extraDataLen + 1; @@ -372,8 +380,14 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) edLen = extraDataLen; memset(extraData, 'X', edLen); extraData[edLen] = '\0'; - *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c", - msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim); + if(useRFC5424Format) { + *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood " + "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c", + msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim); + } else { + *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c", + msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim); + } } } else { /* use fixed message format from command line */ @@ -830,7 +844,7 @@ int main(int argc, char *argv[]) setvbuf(stdout, buf, _IONBF, 48); - while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:Yz:Z:")) != -1) { + while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:yYz:Z:")) != -1) { switch (opt) { case 'b': batchsize = atoll(optarg); break; @@ -908,6 +922,8 @@ int main(int argc, char *argv[]) break; case 'Y': runMultithreaded = 1; break; + case 'y': useRFC5424Format = 1; + break; case 'z': tlsKeyFile = optarg; break; case 'Z': tlsCertFile = optarg; diff --git a/tests/testsuites/global_vars.conf b/tests/testsuites/global_vars.conf new file mode 100644 index 00000000..0d1a3cb8 --- /dev/null +++ b/tests/testsuites/global_vars.conf @@ -0,0 +1,17 @@ +$IncludeConfig diag-common.conf + +$MainMsgQueueTimeoutShutdown 10000 + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="outfmt" type="string" string="%$/msgnum%\n") +template(name="dynfile" type="string" string="rsyslog.out.log") /* trick to use relative path names! */ + +if $/msgnum == "" then + set $/msgnum = 0; + +if $msg contains "msgnum:" then { + action(type="omfile" dynaFile="dynfile" template="outfmt") + set $/msgnum = $/msgnum + 1; +} diff --git a/tests/testsuites/mmpstrucdata.conf b/tests/testsuites/mmpstrucdata.conf new file mode 100644 index 00000000..fd18fd99 --- /dev/null +++ b/tests/testsuites/mmpstrucdata.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/mmpstrucdata/.libs/mmpstrucdata") +module(load="../plugins/imtcp/.libs/imtcp") + +template(name="outfmt" type="string" string="%$!rfc5424-sd!tcpflood@32473!msgnum%\n") + +input(type="imtcp" port="13514") + +action(type="mmpstrucdata") +if $msg contains "msgnum" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/rfc5424parser.conf b/tests/testsuites/rfc5424parser.conf new file mode 100644 index 00000000..cd90d120 --- /dev/null +++ b/tests/testsuites/rfc5424parser.conf @@ -0,0 +1,10 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +input(type="imtcp" port="13514") + +if $msg contains "msgnum" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/rs_optimizer_pri.conf b/tests/testsuites/rs_optimizer_pri.conf new file mode 100644 index 00000000..9ff27dc8 --- /dev/null +++ b/tests/testsuites/rs_optimizer_pri.conf @@ -0,0 +1,8 @@ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $syslogfacility-text == "local4" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/rulesetmultiqueue-v6.conf b/tests/testsuites/rulesetmultiqueue-v6.conf new file mode 100644 index 00000000..3aeaa337 --- /dev/null +++ b/tests/testsuites/rulesetmultiqueue-v6.conf @@ -0,0 +1,34 @@ +# Test for multiple ruleset queues (see .sh file for details) +# rgerhards, 2009-10-30 +$IncludeConfig diag-common.conf +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 + +# general definition +$template outfmt,"%msg:F,58:2%\n" + +# create the individual rulesets +$template dynfile1,"rsyslog.out1.log" # trick to use relative path names! +ruleset(name="file1" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile1;outfmt +} + +$template dynfile2,"rsyslog.out2.log" # trick to use relative path names! +ruleset(name="file2" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile2;outfmt +} + +$template dynfile3,"rsyslog.out3.log" # trick to use relative path names! +ruleset(name="file3" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile3;outfmt +} + +# start listeners and bind them to rulesets +$InputTCPServerBindRuleset file1 +$InputTCPServerRun 13514 + +$InputTCPServerBindRuleset file2 +$InputTCPServerRun 13515 + +$InputTCPServerBindRuleset file3 +$InputTCPServerRun 13516 diff --git a/tests/testsuites/stop-localvar.conf b/tests/testsuites/stop-localvar.conf index 020ebd87..63df6509 100644 --- a/tests/testsuites/stop-localvar.conf +++ b/tests/testsuites/stop-localvar.conf @@ -5,17 +5,17 @@ * rgerhards, 2013-11-19 */ $IncludeConfig diag-common.conf -template(name="outfmt" type="string" string="%$!nbr%\n") +template(name="outfmt" type="string" string="%$.nbr%\n") module(load="../plugins/imtcp/.libs/imtcp") input(type="imtcp" port="13514") if $msg contains "msgnum:" then { - set $!nbr = field($msg, 58, 2); - if cnum($!nbr) < 100 then + set $.nbr = field($msg, 58, 2); + if cnum($.nbr) < 100 then stop /* check is intentionally more complex than needed! */ - else if not (cnum($!nbr) > 999) then { + else if not (cnum($.nbr) > 999) then { action(type="omfile" file="rsyslog.out.log" template="outfmt") } } diff --git a/tests/testsuites/stop.conf b/tests/testsuites/stop.conf new file mode 100644 index 00000000..84beab82 --- /dev/null +++ b/tests/testsuites/stop.conf @@ -0,0 +1,11 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $msg contains "00000001" then + stop + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +if $msg contains "msgnum:" then + action(type="omfile" file="rsyslog.out.log" template="outfmt") |