rsyslog.conf: first load default modules, then third-party config

When we installed file /etc/rsyslog.d/03-ratelimits.conf:

    $IMJournalStateFile imjournal.state
    $IMJournalPersistStateInterval 1000
    $IMJournalRatelimitInterval 1
    $IMJournalRatelimitBurst 10000

rsyslog failed:

    invalid or yet-unknown config file command 'IMJournalStateFile' - have you forgotten to load a module? [v8.2010.0 try https://www.rsyslog.com/e/3003 ]
    invalid or yet-unknown config file command 'IMJournalPersistStateInterval' - have you forgotten to load a module? [v8.2010.0 try https://www.rsyslog.com/e/3003 ]
    invalid or yet-unknown config file command 'IMJournalRatelimitInterval' - have you forgotten to load a module? [v8.2010.0 try https://www.rsyslog.com/e/3003 ]
    invalid or yet-unknown config file command 'IMJournalRatelimitBurst' - have you forgotten to load a module? [v8.2010.0 try https://www.rsyslog.com/e/3003 ]

That's because imjournal was loaded later than that config file.  If
module was explicitly loaded via '$ModLoad imjournal' in our third-party
file, we got a different error:

    module 'imjournal' already in this config, cannot be added  [v8.2010.0 try https://www.rsyslog.com/e/2221 ]

When the config file is reordered like this, no errors are shown.

Resolves: rhbz#1985202
This commit is contained in:
Pavel Raiskup 2021-07-23 08:54:42 +02:00
parent 6ad07b6b5a
commit ad5200aa8c
2 changed files with 12 additions and 8 deletions

View File

@ -9,19 +9,20 @@
# Where to place auxiliary files
global(workDirectory="/var/lib/rsyslog")
#### MODULES ####
# Use default timestamp format
module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
module(load="imuxsock" # provides support for local system logging (e.g. via logger command)
SysSock.Use="off") # Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
module(load="imjournal" # provides access to the systemd journal
StateFile="imjournal.state") # File to store the position in the journal
# Include all config files in /etc/rsyslog.d/
include(file="/etc/rsyslog.d/*.conf" mode="optional")
#### MODULES ####
module(load="imuxsock" # provides support for local system logging (e.g. via logger command)
SysSock.Use="off") # Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
module(load="imjournal" # provides access to the systemd journal
StateFile="imjournal.state") # File to store the position in the journal
#module(load="imklog") # reads kernel messages (the same are read from journald)
#module(load="immark") # provides --MARK-- message capability

View File

@ -8,7 +8,7 @@
Summary: Enhanced system logging and kernel message trapping daemon
Name: rsyslog
Version: 8.2102.0
Release: 3%{?dist}
Release: 4%{?dist}
License: (GPLv3+ and ASL 2.0)
URL: http://www.rsyslog.com/
Source0: http://www.rsyslog.com/files/download/rsyslog/%{name}-%{version}.tar.gz
@ -550,6 +550,9 @@ done
%changelog
* Tue Jul 27 2021 Pavel Raiskup <praiskup@redhat.com> - 8.2102.0-4
- reorder the rsyslog.conf to simplify the rsyslog.d configuration (#1985202)
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.2102.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild