Description of problem:
I'm using the form rsyslogd -N to verify a config file. However I see that it doesn't set the return status to some non-zero value if an error is found in said file (to be sure, the manpage doesn't advertise such a thing anyway, so it's not a bug). It makes taking automatic action a bit problematic.
Version-Release number of selected component (if applicable):
KEDDESADM01:/usr/local/sbin/des_checkout # rsyslogd -v
rsyslogd 7.4.7, compiled with:
GSSAPI Kerberos 5 support: Yes
FEATURE_DEBUG (debug build, slow code): No
32bit Atomic operations supported: Yes
64bit Atomic operations supported: Yes
Runtime Instrumentation (slow code): No
uuid support: Yes
Steps to Reproduce:
Starting with the out-of-the-box /etc/rsyslog.conf, I have installed a customized config. in /etc/rsyslog.d/DCS.conf:
:msg, eregex, "^(Starting|Stopping) user-[0-9]+\.slice" stop
Clearly the designator "eregex" is erroneous and is indeed detected via -N, yet $? is not set non-zero as perhaps it should be:
KEDDESADM01:/usr/local/src/functions/utils # rsyslogd -N 1
rsyslogd: version 7.4.7, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: error: invalid compare operation 'eregex' - ignoring selector
rsyslogd: End of config validation run. Bye.
KEDDESADM01:/usr/local/src/functions/utils # echo $?
Set as 0
Should be set as non-zero
Does your config file contain such option like "$AbortOnUncleanConfig on" ?
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.