这个简短的说明解释了将审计日志定向到 CentOS/RHEL 6,7 服务器上的远程 rsyslog 服务器的步骤。
服务器端配置
执行以下步骤来设置系统日志服务器:
- 在 /etc/rsyslog.conf 的“MODULES”部分取消注释以下行:
# vi /etc/rsyslog.conf $ModLoad imtcp $InputTCPServerRun 514
如果我们使用的是 UDP,则取消注释以下行:
# vi /etc/rsyslog.conf $ModLoad imudp $UDPServerRun 514
- 配置 rsyslog 服务器以接收来自客户端的 rsyslog 事件。
要从客户端服务器接收审计日志,请在 /etc/rsyslog.conf 文件中添加以下行:
# vi /etc/rsyslog.conf $template HostAudit, "/var/log/rsyslog/%HOSTNAME%/audit_log" local6.* ?HostAudit
- 重启rsyslog服务。
# service rsyslog restart ### CentOS/RHEL 6 # systemctl restart rsyslog ### CentOS/RHEL 7
https://onitroad.com 更多教程
客户端配置
- 备份现有的 /etc/rsyslog.conf。
# cp /etc/rsyslog.conf /etc/rsyslog.conf.bkp
- 将以下规则添加到 /etc/rsyslog.conf 文件以将日志定向到中央 rsyslog 服务器。
必须在 rsyslogd 上加载“imfile”模块,否则用于定向审计日志的配置将不起作用。
# vi /etc/rsyslog.conf #audit log $ModLoad imfile $InputFileName /var/log/audit/audit.log $InputFileTag tag_audit_log: $InputFileStateFile audit_log $InputFileSeverity info $InputFileFacility local6 $InputRunFileMonitor *.* @[serverip] ### Add rsyslog server IP here
确保将 @[serverip] 替换为 rsyslog 服务器 IP 地址。
- 重新启动 rsyslog 服务以使更改生效。
# service rsyslog restart ### CentOS/RHEL 6 # systemctl restart rsyslog ### CentOS/RHEL 7
日期:2020-09-17 00:13:51 来源:oir作者:oir