收集 Arista 交换机日志
解析器版本: 3.0
本文档介绍了如何使用 Bindplane 代理将 Arista 交换机日志注入 Google Security Operations。
Arista EOS(可扩展操作系统)在 Arista 网络交换机上运行,并为系统事件、接口更改、身份验证、AAA 记账和协议状态更改生成 syslog 消息。解析器可处理 JSON 和 syslog 格式。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例
- Windows Server 2016 或更高版本,或者具有
systemd的 Linux 主机 - Bindplane 代理与 Arista 交换机之间的网络连接
- 如果通过代理运行,请确保防火墙端口根据 Bindplane 代理要求处于开放状态
- Arista EOS 4.23.x 或更高版本
- 对 Arista EOS 交换机的特权访问权限
获取 Google SecOps 注入身份验证文件
- 登录 Google SecOps 控制台。
- 前往 SIEM 设置 > 收集代理。
下载数据注入身份验证文件 。将该文件安全地保存在将安装 Bindplane 的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 前往 SIEM 设置 > 个人资料。
从组织详细信息 部分复制并保存客户 ID 。
安装 Bindplane 代理
按照以下说明在 Windows 或 Linux 操作系统上安装 Bindplane 代理。
Windows 安装
- 以管理员身份打开命令提示符 或 PowerShell 。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安装完成。
运行以下命令,验证安装是否成功:
sc query observiq-otel-collector该服务应显示为正在运行 。
Linux 安装
- 打开具有 root 或 sudo 权限的终端。
运行以下命令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh等待安装完成。
运行以下命令,验证安装是否成功:
sudo systemctl status observiq-otel-collector该服务应显示为活跃 (正在运行) 。
其他安装资源
如需了解其他安装选项和问题排查信息,请参阅 Bindplane 代理安装指南。
配置 Bindplane 代理以注入 syslog 并将其发送到 Google SecOps
找到配置文件
Linux:
sudo nano /etc/bindplane-agent/config.yamlWindows:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
修改配置文件
将
config.yaml的全部内容替换为以下配置:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/arista_switch: compression: gzip creds_file_path: '/etc/bindplane-agent/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: ARISTA_SWITCH raw_log_field: body service: pipelines: logs/arista_to_chronicle: receivers: - udplog exporters: - chronicle/arista_switch
配置参数
替换以下占位符:
接收器配置:
listen_address:要监听的 IP 地址和端口:0.0.0.0,用于监听所有接口(推荐)- 端口
514是标准 syslog 端口(在 Linux 上需要 root;对于非 root 用户,请使用1514)
导出器配置:
creds_file_path:注入身份验证文件的完整路径:- Linux:
/etc/bindplane-agent/ingestion-auth.json - Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Linux:
customer_id:从 Google SecOps 控制台复制的客户 IDendpoint:区域级端点网址:- 美国:
malachiteingestion-pa.googleapis.com - 欧洲:
europe-malachiteingestion-pa.googleapis.com - 亚洲:
asia-southeast1-malachiteingestion-pa.googleapis.com - 如需查看完整列表,请参阅区域级端点
- 美国:
保存配置文件
- 修改后,保存文件:
- Linux:按
Ctrl+O,然后按Enter,再按Ctrl+X - Windows:依次点击文件 > 保存
- Linux:按
重启 Bindplane 代理以应用更改
如需在 Linux 中重启 Bindplane 代理,请运行以下命令:
sudo systemctl restart observiq-otel-collector验证服务正在运行:
```bash sudo systemctl status observiq-otel-collector ```检查日志中的错误:
```bash sudo journalctl -u observiq-otel-collector -f ```
如需在 Windows 中重启 Bindplane 代理,请选择以下选项之一:
以管理员身份运行命令提示符或 PowerShell:
net stop observiq-otel-collector && net start observiq-otel-collector“服务”控制台:
- 按
Win+R,输入services.msc,然后按 Enter 键。 - 找到 observIQ OpenTelemetry Collector 。
- 右键点击并选择重启 。
验证服务正在运行:
sc query observiq-otel-collector检查日志中的错误:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
- 按
在 Arista 交换机上配置 syslog
- 登录 Arista 交换机。
进入配置模式:
Arista# configure terminal配置 syslog 目标以将日志发送到 Bindplane 代理:
Arista(config)# logging host <bindplane-server-ip> <port-number> protocol udp Arista(config)# logging trap informational Arista(config)# copy running-config startup-config- 将
<bindplane-server-ip>替换为 Bindplane 代理 IP 地址。 - 将
<port-number>替换为配置为监听的端口(例如514)。
- 将
(可选)为 AAA 记账启用命令执行日志记录:
Arista(config)# aaa accounting commands all console start-stop logging Arista(config)# aaa accounting commands all default start-stop logging Arista(config)# aaa accounting exec console start-stop logging Arista(config)# aaa accounting exec default start-stop logging Arista(config)# copy running-config startup-config(可选)启用身份验证成功和失败日志记录:
Arista(config)# aaa authentication policy on-success log Arista(config)# aaa authentication policy on-failure log Arista(config)# copy running-config startup-config
UDM 映射表
| 日志字段 | UDM 映射 | 逻辑 |
|---|---|---|
appname |
target.application |
直接从 appname 字段映射。 |
description |
metadata.description |
直接从 description 字段映射,该字段使用基于 product_event_type 的 grok 模式从 message 字段中提取。 |
dst_ip |
target.ip、target.asset.ip |
直接从 dst_ip 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
dst_mac |
target.mac |
直接从 dst_mac 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
dst_port |
target.port |
直接从 dst_port 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
facility |
additional.fields[facility].string_value |
直接从 facility 字段映射。 |
hostname |
principal.hostname、principal.asset.hostname |
直接从 hostname 字段映射。 |
inner_msg |
metadata.description |
直接从 inner_msg 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
ip_protocol |
network.ip_protocol |
直接从 ip_protocol 字段映射,该字段使用 grok 模式从 message 字段中提取。 如果值为“tcp”,则转换为“TCP”。如果事件类型为“NO_IGMP_QUERIER”,则设置为“IGMP”。 |
pid |
principal.process.pid |
直接从 pid 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
prin_ip |
principal.ip、principal.asset.ip |
直接从 prin_ip 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
product_event_type |
metadata.product_event_type |
直接从 product_event_type 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
proto |
network.application_protocol |
如果 proto 字段为“sshd”,则 UDM 字段设置为“SSH”。 |
severity |
security_result.severity、security_result.severity_details |
security_result.severity 是根据以下映射从 severity 字段派生的:“DEFAULT”“DEBUG”“INFO”“NOTICE”->“INFORMATIONAL”;“WARNING”“ERROR”“ERR”“WARN”->“MEDIUM”;“CRITICAL”“ALERT”“EMERGENCY”->“HIGH”。severity 的原始值映射到 security_result.severity_details。 |
session_id |
network.session_id |
直接从 session_id 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
source_ip |
principal.ip、principal.asset.ip |
直接从 source_ip 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
source_port |
principal.port |
直接从 source_port 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
src_ip |
principal.ip、principal.asset.ip |
直接从 src_ip 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
table_name |
target.resource.name |
直接从 table_name 字段映射,该字段使用 grok 模式从 message 字段中提取。如果填充此字段,则 target.resource.resource_type 设置为“TABLE”。 |
target_host |
target.hostname、target.asset.hostname |
直接从 target_host 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
target_ip |
target.ip、target.asset.ip |
直接从 target_ip 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
target_package |
target.process.command_line |
直接从 target_package 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
target_port |
target.port |
直接从 target_port 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
timestamp |
metadata.event_timestamp |
在解析为时间戳对象后直接从 timestamp 字段映射。 |
user |
principal.user.userid |
直接从 user 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
user_name |
target.user.userid |
直接从 user_name 字段映射,该字段使用 grok 模式从 message 字段中提取。 |
vrf |
additional.fields[vrf].string_value |
直接从 vrf 字段映射,该字段使用 grok 模式从 message 字段中提取。根据解析器代码中所述的复杂条件逻辑,从 has_principal、has_target、user、message、product_event_type 和 description 字段的组合派生。默认值为“GENERIC_EVENT”。硬编码为“ARISTA_SWITCH”。硬编码为“Arista Switch”。硬编码为“Arista”。如果 description 字段包含“connection rejected”,则设置为“BLOCK”。 |
dpid |
additional.fields[DPID].string_value |
直接从 dpid 字段映射。 |
intf |
additional.fields[intf].string_value |
直接从 intf 字段映射。 |