我按照 Red Hat 网站上的步骤进行操作https://access.redhat.com/articles/4058681在没有journald的情况下配置系统日志记录,但重新启动后rsyslog无法启动。
- 编辑/etc/rsyslog.conf rsyslog配置文件;打开“on”使用 imuxsock 本地消息,注释掉 imjournal 模块的加载并取消注释 imklog 模块的加载:
module(load="imuxsock" # provides support for local system logging (e.g. via the logger command)
SysSock.Use="on")
# 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)
- 编辑 /etc/systemd/journald.conf 中的日志配置;将日志切换到仅内存模式并启用转发:
[Journal]
Storage=none
ForwardToSyslog=yes
- 在 /etc/systemd/system/rsyslog.service.d/override.conf 中为 rsyslog 单元配置文件创建 drop-in,其中包含以下内容以确保套接字创建和链接:
[Unit]
Requires=syslog.socket
[Install]
Alias=syslog.service
当我尝试手动启动它时,收到以下错误消息
A dependency job for rsyslog.service failed. See 'journalctl -xe' for details.
但看起来 rsyslog 守护进程启动正常
$ sudo systemctl start rsyslog | grep Active
A dependency job for rsyslog.service failed. See 'journalctl -xe' for details.
$ sudo systemctl status rsyslog | grep Active
Active: active (running) since Sat 2020-10-24 01:19:37 EDT; 3s ago
$ sudo systemctl stop rsyslog | grep Active
$ sudo systemctl status rsyslog | grep Active
Active: inactive (dead) since Sat 2020-10-24 01:19:54 EDT; 2s ago
$ sudo systemctl start rsyslog | grep Active
A dependency job for rsyslog.service failed. See 'journalctl -xe' for details.
$ sudo systemctl status rsyslog | grep Active
Active: active (running) since Sat 2020-10-24 01:20:07 EDT; 3s ago
Journalctl -xe 显示以下信息,日期是我在没有日记的情况下配置系统日志记录的日期
Oct 16 14:20:34 systemd-journal[89]: Journal stopped
-- Subject: The journal has been stopped
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system journal process has shut down and closed all currently
-- active journal files.
知道为什么 rsyslog 在重新启动期间没有启动,手动启动正常但给出了该错误消息吗?