Show Table of Contents
19.5. 设置虚拟主机日志服务器
主机会通过产生和更新日志文件来记录系统的运行情况。为了简化故障排除的过程,我们可以使用一个“日志服务器”来统一收集日志文件的信息。
您可以使用一个独立的日志服务器,也可以通过以下步骤在 Red Hat Virtualization Manager 上实现日志服务器的功能。
过程 19.1. 设置虚拟主机日志服务器
- 设置 SELinux 来允许 rsyslog 操作。
# semanage port -a -t syslogd_port_t -p udp 514
- 编辑
/etc/rsyslog.conf来添加以下行:$template TmplAuth, "/var/log/%fromhost%/secure" $template TmplMsg, "/var/log/%fromhost%/messages" $RuleSet remote authpriv.* ?TmplAuth *.info,mail.none;authpriv.none,cron.none ?TmplMsg $RuleSet RSYSLOG_DefaultRuleset $InputUDPServerBindRuleset remote
去掉以下行的注释#$ModLoad imudp #$UDPServerRun 514
- 重新启动 rsyslog 服务:
# systemctl restart rsyslog.service
您的日志服务器已经被配置,它可以接收和存储虚拟主机上的
messages 和 secure 日志文件。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.