blob: 72ef168427b404f286e7eab61c28319fe30a3860 (
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
# addd 2016-10-06 by RGerhards, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
. $srcdir/diag.sh check-inotify
generate_conf
add_conf '
module(load="../plugins/imfile/.libs/imfile")
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input" Tag="file:" reopenOnTruncate="on")
template(name="outfmt" type="string" string="%msg:F,58:2%\n")
if $msg contains "msgnum:" then {
action( type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
} else {
action( type="omfile" file="'$RSYSLOG_DYNNAME'.rsyslog")
}
'
# write the beginning of the file
echo 'msgnum:0
msgnum:1' > $RSYSLOG_DYNNAME.input
startup
wait_queueempty # wait for message to be processed
# truncate and write some more lines (see https://github.com/rsyslog/rsyslog/issues/1090)
echo 'msgnum:2' > $RSYSLOG_DYNNAME.input
wait_queueempty # wait for message to be processed
echo 'msgnum:3
msgnum:4' >> $RSYSLOG_DYNNAME.input
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown
printf 'Messages from rsyslog itself:\n'
cat -n $RSYSLOG_DYNNAME.rsyslog
seq_check 0 4
exit_test
|