blob: 2faae1a854798c0e8b08a3220299a8b8bebbd0f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/bash
# This test tests impstats omfwd counters in TCP mode
# added 2021-02-11 by rgerhards. Released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
export STATSFILE="$RSYSLOG_DYNNAME.stats"
add_conf '
$MainMsgQueueTimeoutShutdown 10000
module(load="../plugins/impstats/.libs/impstats" log.file="'$STATSFILE'"
interval="1" ruleset="stats")
ruleset(name="stats") {
stop # nothing to do here
}
template(name="outfmt" type="string" string="%msg:F,58:2%\n")
module(load="builtin:omfwd" template="outfmt")
if $msg contains "msgnum:" then
action(type="omfwd" target="127.0.0.1" port="'$TCPFLOOD_PORT'" protocol="tcp")
'
./minitcpsrv -t127.0.0.1 -p$TCPFLOOD_PORT -f $RSYSLOG_OUT_LOG &
BGPROCESS=$!
echo background minitcpsrv process id is $BGPROCESS
# now do the usual run
startup
# 10000 messages should be enough
injectmsg 0 10000
shutdown_when_empty
wait_shutdown
# note: minitcpsrv shuts down automatically if the connection is closed!
# check pstats - that's our prime test target
content_check --regex "TCP-.*origin=omfwd .*bytes.sent=[1-9][0-9][0-9]" "$STATSFILE"
# do a bonus test while we are at it (just make sure we actually sent data)
seq_check 0 9999
exit_test
|