| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # alorbach, 2019-01-16 |
| 3 | # This file is part of the rsyslog project, released under ASL 2.0 |
| 4 | . ${srcdir:=.}/diag.sh init |
| 5 | export NUMMESSAGES=1000 |
| 6 | # uncomment for debugging support: |
| 7 | #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" |
| 8 | export RSYSLOG_DEBUGLOG="log" |
| 9 | generate_conf |
| 10 | add_conf ' |
| 11 | global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" |
| 12 | defaultNetstreamDriverCertFile="'$srcdir/tls-certs/cert.pem'" |
| 13 | defaultNetstreamDriverKeyFile="'$srcdir/tls-certs/key.pem'" |
| 14 | ) |
| 15 | module(load="../plugins/imtcp/.libs/imtcp" StreamDriver.Name="gtls" |
| 16 | StreamDriver.Mode="1" StreamDriver.AuthMode="anon" ) |
| 17 | |
| 18 | # then SENDER sends to this port (not tcpflood!) |
| 19 | input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") |
| 20 | |
| 21 | template(name="outfmt" type="string" string="%msg:F,58:2%\n") |
| 22 | if $msg contains "msgnum:" then |
| 23 | action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") |
| 24 | ' |
| 25 | startup |
| 26 | export RCVR_PORT=$TCPFLOOD_PORT |
| 27 | export RSYSLOG_DEBUGLOG="log2" |
| 28 | #valgrind="valgrind" |
| 29 | generate_conf 2 |
| 30 | add_conf ' |
| 31 | global(defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'") |
| 32 | |
| 33 | action( type="omfwd" |
| 34 | protocol="tcp" |
| 35 | target="127.0.0.1" |
| 36 | port="'$RCVR_PORT'" |
| 37 | StreamDriver="gtls" |
| 38 | StreamDriverMode="1" |
| 39 | StreamDriverAuthMode="x509/certvalid" |
| 40 | ) |
| 41 | ' 2 |
| 42 | startup 2 |
| 43 | |
| 44 | # now inject the messages into instance 2. It will connect to instance 1, |
| 45 | # and that instance will record the data. |
| 46 | injectmsg2 |
| 47 | wait_file_lines |
| 48 | # shut down sender when everything is sent, receiver continues to run concurrently |
| 49 | shutdown_when_empty 2 |
| 50 | wait_shutdown 2 |
| 51 | # now it is time to stop the receiver as well |
| 52 | shutdown_when_empty |
| 53 | wait_shutdown |
| 54 | |
| 55 | seq_check |
| 56 | exit_test |