rsyslog/tests/imfile-wildcards-dirs-multi3.sh
Andre Lorbach af09d33b49 imfile: Partially fixed issues not detecting files in directory when wildcards are used.
When directories and files are created at the same time,
imfile may missed subdirs or file if the machine is on high load.

The handling has been enhanced to scan newly created directories ALWAYS for
matching files.

This should fix following issues:
closes https://github.com/rsyslog/rsyslog/issues/2271

However we still have a problem when a multilevel directory configurations.
Details are discussed here https://github.com/rsyslog/rsyslog/issues/2354
2018-01-05 12:59:19 +01:00

51 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# This is part of the rsyslog testbench, licensed under GPLv3
export IMFILEINPUTFILES="1"
export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="5"
. $srcdir/diag.sh init
. $srcdir/diag.sh check-inotify-only
# 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.input.dir$i"
mkdir rsyslog.input.dir$i
done
# Start rsyslog now before adding more files
. $srcdir/diag.sh startup imfile-wildcards-dirs-multi3.conf
# 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.input.dir$i/dir$j/testdir"
mkdir rsyslog.input.dir$i/dir$j
mkdir rsyslog.input.dir$i/dir$j/testdir
mkdir rsyslog.input.dir$i/dir$j/testdir/subdir$j
./inputfilegen -m 1 > rsyslog.input.dir$i/dir$j/testdir/subdir$j/file.logfile
done
ls -d rsyslog.input.*
# Check correct amount of input files each time
let IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $j))
. $srcdir/diag.sh content-check-with-count "HEADER msgnum:00000000:" $IMFILEINPUTFILESALL $IMFILECHECKTIMEOUT
# Delete all but first!
for i in `seq 1 $IMFILEINPUTFILES`;
do
rm -rf rsyslog.input.dir$i/dir$j/testdir/subdir$j/file.logfile
rm -rf rsyslog.input.dir$i/dir$j
done
done
. $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
. $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
. $srcdir/diag.sh exit