| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # add 2016-11-22 by Pascal Withopf, released under ASL 2.0 |
| 3 | . ${srcdir:=.}/diag.sh init |
| 4 | generate_conf |
| 5 | add_conf ' |
| 6 | module(load="../plugins/imtcp/.libs/imtcp") |
| 7 | input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="customparser") |
| 8 | parser(name="custom.rfc3164" type="pmrfc3164" force.tagEndingByColon="on") |
| 9 | template(name="outfmt" type="string" string="-%syslogtag%-%msg%-\n") |
| 10 | |
| 11 | ruleset(name="customparser" parser="custom.rfc3164") { |
| 12 | :syslogtag, contains, "tag" action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG`) |
| 13 | } |
| 14 | ' |
| 15 | startup |
| 16 | tcpflood -m1 -M "\"<129>Mar 10 01:00:00 Hostname1 tag1: msgnum:1\"" |
| 17 | tcpflood -m1 -M "\"<129>Mar 10 01:00:00 Hostname2 tag2: msgnum:2\"" |
| 18 | tcpflood -m1 -M "\"<129>Mar 10 01:00:00 Hostname3 tag3 msgnum:3\"" |
| 19 | tcpflood -m1 -M "\"<129>Mar 10 01:00:00 Hostname4 tag4 :\"" |
| 20 | tcpflood -m1 -M "\"<129>Mar 10 01:00:00 Hostname5 tag5:msgnum:5\"" |
| 21 | shutdown_when_empty |
| 22 | wait_shutdown |
| 23 | echoscip-shell system . . echo. '-tag1:- msgnum:1- |
| 24 | -tag2:- msgnum:2- |
| 25 | -tag5:-msgnum:5-' | cmpscip-shell system . . cmp. - $RSYSLOG_OUT_LOG |
| 26 | if [scip-shell system . . `[`. ! $? -eq 0 ]; then |
| 27 | echoscip-shell system . . echo. "invalid response generated, $RSYSLOG_OUT_LOG is:" |
| 28 | catscip-shell system . . cat. $RSYSLOG_OUT_LOG |
| 29 | error_exit 1 |
| 30 | fi; |
| 31 | |
| 32 | exit_test |