您可以配置将 CEF 格式的事件发布到外部 SIEM 系统,以及将事件本地保存在服务器上的日志文件中。Astra Linux 特别版上 KSMG 的事件发布配置过程与在其他操作系统上配置 KSMG 的过程不同。
在您想要将事件发布到 SIEM 系统的每个集群节点上执行以下步骤。仅在配置事件发布后才启用 CEF 格式的事件导出。
在 Rocky Linux、Ubuntu、Red Hat Enterprise Linux、Debian 和 RED OS 上配置应用程序事件的导出
使用 rsyslog 系统日志记录服务将事件发送到外部 SIEM 系统。如果您不需要在本地保存事件,则可以跳过本节说明的第 5、7、8 步。
要配置将应用程序事件发布到 SIEM 系统:
systemctl status rsyslog
服务的状态必须是“正在运行”。
如果 rsyslog 服务未运行或未安装,请按照操作系统文档中的说明安装并启用 rsyslog 服务。
$ActionQueueFileName ForwardToSIEM
$ActionQueueMaxDiskSpace 1g
$ActionQueueSaveOnShutdown on
$ActionQueueType LinkedList
$ActionResumeRetryCount -1
<CEF 格式的类别(工具)>.* @<SIEM 系统的 IP 地址>:<SIEM 系统用于通过 UDP 从 Syslog 接收消息的端口>
如果您想通过 TCP 发送事件,请添加以下行:
<CEF 格式的类别(工具)>.* @<SIEM 系统的 IP 地址>:<SIEM 系统用于通过 TCP 从 Syslog 接收消息的端口>
<CEF 格式的工具>.* -/var/log/klms-cef-messages
<CEF 格式的工具>.* stop
通过 UDP 导出而不保存到本地日志的示例配置文件: $ActionQueueFileName ForwardToSIEM2 $ActionQueueMaxDiskSpace 1g $ActionQueueSaveOnShutdown on $ActionQueueType LinkedList $ActionResumeRetryCount -1 local2.* @10.16.32.64:514 local2.* stop 通过 TCP 导出并保存到本地日志的示例配置文件: $ActionQueueFileName ForwardToSIEM2 $ActionQueueMaxDiskSpace 1g $ActionQueueSaveOnShutdown on $ActionQueueType LinkedList $ActionResumeRetryCount -1 local2.* @10.16.32.64:514 local2.* -/var/log/ksmg-cef-messages local2.* stop |
touch /var/log/ksmg-cef-messages
chown root:klusers /var/log/ksmg-cef-messages
chmod 640 /var/log/ksmg-cef-messages
/var/log/ksmg-cef-messages
{
size 500M
rotate 10
compress
missingok
notifempty
sharedscripts
postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
endscript
}
systemctl restart rsyslog
systemctl status rsyslog
状态必须是running。
logger -p <CEF 格式的类别(工具)>.info 测试消息
将配置向 SIEM 系统发布应用程序事件。
在 Astra Linux 特别版上配置应用程序事件发布
使用 syslog-ng 系统日志记录服务将事件发送到外部 SIEM 系统。如果您不需要在本地保存事件,则可以跳过本节说明的第 5、6、7 步。
要配置将应用程序事件发布到 SIEM 系统:
systemctl status syslog-ng
服务的状态必须是“正在运行”。
如果 syslog-ng 服务未运行或未安装,请按照操作系统文档中的说明安装并启用 syslog-ng 服务。
filter f_ksmgcef { facility(<CEF 格式的工具>); };
destination d_ksmgcef_forward { network("<SIEM 系统的 IP 地址>" transport("udp") port(<SIEM 系统用于通过 UDP 从 Syslog 接收邮件的端口>)); };
log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_forward); };
如果您想通过 TCP 发送事件,请向文件添加以下行:
destination d_ksmgcef_forward { network("<SIEM 系统的 IP 地址>" transport("tcp") port(<SIEM 系统用于通过 TCP 从 Syslog 接收邮件的端口>)); };
log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_forward); };
destination d_ksmgcef_logfile { file("/var/log/ksmg-cef-messages"); };
log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_logfile); };
通过 UDP 导出而不保存到本地日志的示例配置文件: filter f_ksmgcef { facility(local2); }; destination d_ksmgcef_forward { network("10.16.32.64" transport("udp") port(514)); }; log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_forward); }; 通过 TCP 导出并保存到本地日志的示例配置文件: filter f_ksmgcef { facility(local2); }; destination d_ksmgcef_forward { network("10.16.32.64" transport("tcp") port(514)); }; log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_forward); }; destination d_ksmgcef_logfile { file("/var/log/ksmg-cef-messages"); }; log { source(s_src); filter(f_ksmgcef); destination(d_ksmgcef_logfile); }; |
touch /var/log/ksmg-cef-messages
chown root:klusers /var/log/ksmg-cef-messages
chmod 640 /var/log/ksmg-cef-messages
/var/log/ksmg-cef-messages
{
size 500M
rotate 10
compress
missingok
notifempty
sharedscripts
postrotate
invoke-rc.d syslog-ng reload > /dev/null
endscript
}
systemctl restart rsyslog
systemctl status rsyslog
服务的状态必须是“正在运行”。
logger -p <CEF 格式的类别(工具)>.info 测试消息
将配置向 SIEM 系统发布应用程序事件。
页面顶部