17.5. 设置虚拟主机日志服务器

Red Hat Enterprise Virtualization 主机会通过产生和更新日志文件来记录系统的运行情况。为了简化故障排除的过程,我们可以使用一个“日志服务器”来统一收集日志文件的信息。
您可以使用一个独立的日志服务器,也可以通过以下步骤在 Red Hat Enterprise Virtualization Manager 上实现日志服务器的功能。

过程 17.1. 设置虚拟主机日志服务器

  1. 设置 SELinux 来允许 rsyslog 操作。
    # semanage port -a -t syslogd_port_t -p udp 514
  2. 编辑 /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
  3. 重新启动 rsyslog 服务:
    # service rsyslog restart
您的日志服务器已经被配置,它可以接收和存储虚拟主机上的 messagessecure 日志文件。