summaryrefslogtreecommitdiffstats
path: root/tests/imfile-persist-state-1.sh
blob: f3fe3ee439eeb7ab93c5e5f24386d6572d6b2d93 (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
#!/bin/bash
# added 2016-11-02 by rgerhards
# This is part of the rsyslog testbench, licensed under ASL 2.0
. ${srcdir:=.}/diag.sh init
. $srcdir/diag.sh check-inotify
generate_conf
add_conf '
global(workDirectory="'${RSYSLOG_DYNNAME}'.spool")

module(load="../plugins/imfile/.libs/imfile")

input(	type="imfile"
	file="./'$RSYSLOG_DYNNAME'.input"
	tag="file:"
	startmsg.regex="^msgnum"
	PersistStateInterval="1"
)

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")
'
# generate input file first. Note that rsyslog processes it as
# soon as it start up (so the file should exist at that point).
./inputfilegen -m5 -d4000 > $RSYSLOG_DYNNAME.input
startup
shutdown_when_empty
wait_shutdown
seq_check 0 3
exit_test