rsyslog/tests/imfile-wildcards-dirs.sh
Rainer Gerhards 8ea166d89d
testbench: fix some hardcoded names (#2895)
* testbench: fix some hardcoded names

This is prework to make parallel execution of tests possible.
2018-08-01 12:52:17 +02:00

63 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# This is part of the rsyslog testbench, licensed under GPLv3
export IMFILEINPUTFILES="10"
echo [imfile-wildcards-dirs.sh]
. $srcdir/diag.sh check-inotify
. $srcdir/diag.sh init
generate_conf
add_conf '
$WorkDirectory test-spool
/* Filter out busy debug output, comment out if needed */
global(
debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
input(type="imfile"
File="./rsyslog.input.*/*.logfile"
Tag="file:"
Severity="error"
Facility="local7"
addMetadata="on"
)
template(name="outfmt" type="list") {
constant(value="HEADER ")
property(name="msg" format="json")
constant(value="'
add_conf "'"
add_conf ', ")
property(name="$!metadata!filename")
constant(value="\n")
}
if $msg contains "msgnum:" then
action(
type="omfile"
file=`echo $RSYSLOG_OUT_LOG`
template="outfmt"
)
'
# generate input files first. Note that rsyslog processes it as
# soon as it start up (so the file should exist at that point).
# Start rsyslog now before adding more files
startup
for i in `seq 1 $IMFILEINPUTFILES`;
do
mkdir rsyslog.input.dir$i
./inputfilegen -m 1 > rsyslog.input.dir$i/file.logfile
done
ls -d rsyslog.input.*
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
. $srcdir/diag.sh content-check-with-count "HEADER msgnum:00000000:" $IMFILEINPUTFILES
exit_test