Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

19.5. 设置虚拟化主机日志记录服务器

主机生成和更新日志文件,记录其操作和问题。集中收集这些日志文件简化了调试。
这个过程应该在您的集中式日志服务器上使用。您可以使用单独的日志记录服务器,或使用这个流程在 Red Hat Virtualization Manager 上启用主机日志记录。

过程 19.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 服务:
    # systemctl restart rsyslog.service
您的集中式日志服务器现在已配置为从虚拟化主机接收和存储 消息 和安全 日志。