summaryrefslogtreecommitdiffstats
path: root/tests/imfile-wildcards-dirs-multi3.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/imfile-wildcards-dirs-multi3.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/imfile-wildcards-dirs-multi3.sh')
-rwxr-xr-xtests/imfile-wildcards-dirs-multi3.sh96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/imfile-wildcards-dirs-multi3.sh b/tests/imfile-wildcards-dirs-multi3.sh
new file mode 100755
index 0000000..1f851bb
--- /dev/null
+++ b/tests/imfile-wildcards-dirs-multi3.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+# This is part of the rsyslog testbench, licensed under GPLv3
+. ${srcdir:=.}/diag.sh init
+export IMFILEINPUTFILES="1"
+export IMFILEINPUTFILESSTEPS="5"
+#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
+export IMFILECHECKTIMEOUT="60"
+
+mkdir "$RSYSLOG_DYNNAME.work"
+generate_conf
+add_conf '
+/* 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"]
+)
+
+global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
+
+module( load="../plugins/imfile/.libs/imfile"
+ mode="inotify"
+ PollingInterval="1")
+
+input(type="imfile"
+ File="./'$RSYSLOG_DYNNAME'.input.*/*/testdir/*/file.logfile"
+ Tag="file:"
+ Severity="error"
+ Facility="local7"
+ addMetadata="on"
+)
+
+template(name="outfmt" type="list") {
+ constant(value="HEADER ")
+ property(name="msg" format="json")
+ constant(value=", ")
+ 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).
+
+for i in $(seq 1 $IMFILEINPUTFILES);
+do
+ echo "Make $RSYSLOG_DYNNAME.input.dir$i"
+ mkdir $RSYSLOG_DYNNAME.input.dir$i
+ echo created!
+done
+
+# Start rsyslog now before adding more files
+startup
+# sleep a little to give rsyslog a chance to begin processing
+sleep 2
+
+for j in $(seq 1 $IMFILEINPUTFILESSTEPS);
+do
+ echo "Loop Num $j"
+ for i in $(seq 1 $IMFILEINPUTFILES);
+ do
+ echo "Make $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir"
+ mkdir $RSYSLOG_DYNNAME.input.dir$i/dir$j
+ mkdir $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir
+ mkdir $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir/subdir$j
+ touch $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir/subdir$j/file.logfile
+ ./inputfilegen -m 1 > $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir/subdir$j/file.logfile
+ ls -l $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir/subdir$j/file.logfile
+ done
+ ls -d $RSYSLOG_DYNNAME.input.*
+
+ # Check correct amount of input files each time
+ IMFILEINPUTFILESALL=$((IMFILEINPUTFILES * j))
+ content_check_with_count "HEADER msgnum:00000000:" $IMFILEINPUTFILESALL $IMFILECHECKTIMEOUT
+
+ # Delete all but first!
+ for i in $(seq 1 $IMFILEINPUTFILES);
+ do
+ rm -rf $RSYSLOG_DYNNAME.input.dir$i/dir$j/testdir/subdir$j/file.logfile
+ rm -rf $RSYSLOG_DYNNAME.input.dir$i/dir$j
+ done
+
+ # Helps in testbench parallel mode.
+ # Otherwise sometimes directories are not marked deleted in imfile before they get created again.
+ # This is properly a real issue in imfile when FILE IO is high.
+ ./msleep 1000
+done
+
+shutdown_when_empty # shut down rsyslogd when done processing messages
+wait_shutdown # we need to wait until rsyslogd is finished!
+exit_test