我有带有 rsyslog v8.2102.0-113.el9_2.1 的 Red Hat 9.2。
我使用默认/etc/rsyslog.conf以及一个名为vums.conf位于/etc/rsyslog.d/
。
module(load="imfile")
input(type="imfile"
File="/opt/wildfly/standalone/log/server.log"
Tag="wildly")
当我重新启动 rsyslog 时,运行 systemctl status rsyslog 看到以下错误:
[root@konor2 rsyslog.d]# systemctl status rsyslog
● rsyslog.service - System Logging Service
Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; preset: enabled)
Active: active (running) since Wed 2023-12-20 07:32:55 CET; 1s ago
Docs: man:rsyslogd(8)
https://www.rsyslog.com/doc/
Main PID: 574855 (rsyslogd)
Tasks: 4 (limit: 36037)
Memory: 1.4M
CPU: 23ms
CGroup: /system.slice/rsyslog.service
└─574855 /usr/sbin/rsyslogd -n
Dec 20 07:32:55 konor2 systemd[1]: Starting System Logging Service...
Dec 20 07:32:55 konor2 rsyslogd[574855]: module 'imfile' already in this config, cannot be added [v8.2102.0-113.el9_2.1 try https://www.rsyslog.com/e/2221 ]
Dec 20 07:32:55 konor2 rsyslogd[574855]: [origin software="rsyslogd" swVersion="8.2102.0-113.el9_2.1" x-pid="574855" x-info="https://www.rsyslog.com"] start
Dec 20 07:32:55 konor2 systemd[1]: Started System Logging Service.
Dec 20 07:32:55 konor2 rsyslogd[574855]: imjournal: journal files changed, reloading... [v8.2102.0-113.el9_2.1 try https://www.rsyslog.com/e/0 ]
错误告诉我“模块“imfile”已在此配置中,无法添加“如果我注释掉该module(load="imfile")
行,则会收到以下错误:
[root@konor2 rsyslog.d]# systemctl status rsyslog
● rsyslog.service - System Logging Service
Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; preset: enabled)
Active: active (running) since Wed 2023-12-20 07:34:54 CET; 1s ago
Docs: man:rsyslogd(8)
https://www.rsyslog.com/doc/
Main PID: 576081 (rsyslogd)
Tasks: 3 (limit: 36037)
Memory: 5.1M
CPU: 23ms
CGroup: /system.slice/rsyslog.service
└─576081 /usr/sbin/rsyslogd -n
Dec 20 07:34:54 konor2 systemd[1]: Starting System Logging Service...
Dec 20 07:34:54 konor2 rsyslogd[576081]: input module name 'imfile' is unknown [v8.2102.0-113.el9_2.1 try https://www.rsyslog.com/e/2209 ]
Dec 20 07:34:54 konor2 systemd[1]: Started System Logging Service.
Dec 20 07:34:54 konor2 rsyslogd[576081]: error during parsing file /etc/rsyslog.d/vums.conf, on or before line 13: parameter 'Tag' not known -- typo in config file? [v8.2102.0-113.el9_2.1 try https:>
Dec 20 07:34:54 konor2 rsyslogd[576081]: error during parsing file /etc/rsyslog.d/vums.conf, on or before line 13: parameter 'File' not known -- typo in config file? [v8.2102.0-113.el9_2.1 try https>
Dec 20 07:34:54 konor2 rsyslogd[576081]: input module name 'imfile' is unknown [v8.2102.0-113.el9_2.1 try https://www.rsyslog.com/e/2209 ]
Dec 20 07:34:54 konor2 rsyslogd[576081]: error during parsing file /etc/rsyslog.d/vums.conf, on or before line 13: parameter 'Tag' not known -- typo in config file? [v8.2102.0-113.el9_2.1 try https:>
Dec 20 07:34:54 konor2 rsyslogd[576081]: error during parsing file /etc/rsyslog.d/vums.conf, on or before line 13: parameter 'File' not known -- typo in config file? [v8.2102.0-113.el9_2.1 try https>
Dec 20 07:34:54 konor2 rsyslogd[576081]: [origin software="rsyslogd" swVersion="8.2102.0-113.el9_2.1" x-pid="576081" x-info="https://www.rsyslog.com"] start
Dec 20 07:34:54 konor2 rsyslogd[576081]: imjournal: journal files changed, reloading... [v8.2102.0-113.el9_2.1 try https://www.rsyslog.com/e/0 ]
The error tells that "*input module name 'imfile' is unknown*".
我检查了上述两个文件,模块没有重复的加载配置。我还执行了停止、检查进程是否关闭以及守护进程的启动,但结果是一样的。
如何配置 rsyslog 以便能够使用 imfile 模块和输入定义而不会出现上述错误?
EDIT1:只有2个带有配置的文件:
- /etc/rsyslog.conf
- /etc/rsyslog.d/vums.conf 在 中
/etc/rsyslog.conf
,有以下行用于加载自定义配置。
include(file="/etc/rsyslog.d/*.conf" mode="optional")
该module(load=imfile)
行就在vums.conf
文件中。