rsyslog/tests/impstats-hup.sh
Rainer Gerhards 025ed2a933 impstats bugfix: impstats does not handle HUP
If the parameter "log.file" is specified, impstats writes its own
log file. However, HUP is not handled for this file, which makes
the functionality unusable with log rotation. It is also counter-
intuitive for users.

This patch enables correct HUP processing. As a sideline, it also
introduces a generic HUP processing framework for non-action type
of loadable modules.

closes https://github.com/rsyslog/rsyslog/issues/1662
closes https://github.com/rsyslog/rsyslog/issues/1663
2017-07-20 14:22:19 +02:00

27 lines
777 B
Bash
Executable File

#!/bin/bash
# test if HUP works for impstats
# This file is part of the rsyslog project, released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh generate-conf
. $srcdir/diag.sh add-conf '
module(load="../plugins/impstats/.libs/impstats"
log.file="./rsyslog.out.log"
interval="1" ruleset="stats")
ruleset(name="stats") {
stop # nothing to do here
}
'
. $srcdir/diag.sh startup
./msleep 2000
mv rsyslog.out.log rsyslog2.out.log
. $srcdir/diag.sh issue-HUP
./msleep 2000
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
echo checking pre-HUP file
. $srcdir/diag.sh content-check 'global: origin=dynstats' rsyslog2.out.log
echo checking post-HUP file
. $srcdir/diag.sh content-check 'global: origin=dynstats' rsyslog.out.log
. $srcdir/diag.sh exit