收集 Arista 交换机日志

支持的平台:

此解析器可从 Arista 交换机日志中提取字段,同时处理 JSON 和 syslog 格式。它使用 Grok 模式解析各种日志消息类型,将提取的字段映射到 UDM,并根据提取的详细信息使用事件类型、严重程度和主要/目标信息等元数据丰富事件。

准备工作

  • 确保您拥有 Google SecOps 实例。
  • 确保您使用的是 Windows 2016 或更高版本,或者使用了带有 systemd 的 Linux 主机。
  • 如果在代理后面运行,请确保防火墙端口处于打开状态。
  • 已安装且可访问的 Arista EOS 4.23.x 及更高版本。
  • 确保您拥有对 Arista EOS 交换机的超级用户访问权限。

获取 Google SecOps 提取身份验证文件

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 收集代理
  3. 下载提取身份验证文件。将该文件安全地保存在将安装 BindPlane 的系统上。

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次选择 SIEM 设置 > 配置文件
  3. 复制并保存组织详细信息部分中的客户 ID

安装 Bindplane 代理

Windows 安装

  1. 以管理员身份打开命令提示符PowerShell
  2. 运行以下命令:

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

Linux 安装

  1. 打开具有 root 或 sudo 权限的终端。
  2. 运行以下命令:

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
    

其他安装资源

  • 如需了解其他安装选项,请参阅此安装指南

配置 Bindplane 代理以注入 Syslog 并将其发送到 Google SecOps

  1. 访问配置文件:

    1. 找到 config.yaml 文件。通常,在 Linux 上,该目录位于 /etc/bindplane-agent/ 目录中;在 Windows 上,该目录位于安装目录中。
    2. 使用文本编辑器(例如 nanovi 或记事本)打开该文件。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
        udplog:
            # Replace the port and IP address as required
            listen_address: "0.0.0.0:514"
    
    exporters:
        chronicle/chronicle_w_labels:
            compression: gzip
            # Adjust the path to the credentials file you downloaded in Step 1
            creds: '/path/to/ingestion-authentication-file.json'
            # Replace with your actual customer ID from Step 2
            customer_id: <customer_id>
            endpoint: malachiteingestion-pa.googleapis.com
            # Add optional ingestion labels for better organization
            ingestion_labels:
                log_type: ARISTA_SWITCH
                raw_log_field: body
    
    service:
        pipelines:
            logs/source0__chronicle_w_labels-0:
                receivers:
                    - udplog
                exporters:
                    - chronicle/chronicle_w_labels
    
  3. 根据基础架构中的需要替换端口和 IP 地址。

  4. <customer_id> 替换为实际的客户 ID。

  5. 获取 Google SecOps 提取身份验证文件部分中,将 /path/to/ingestion-authentication-file.json 更新为身份验证文件的保存路径。

重启 Bindplane 代理以应用更改

  • 如需在 Linux 中重启 Bindplane 代理,请运行以下命令:

    sudo systemctl restart bindplane-agent
    
  • 如需在 Windows 中重启 Bindplane 代理,您可以使用服务控制台,也可以输入以下命令:

    net stop BindPlaneAgent && net start BindPlaneAgent
    

在 Arista 交换机中配置 Syslog

  1. 登录 Arista 交换机。
  2. 前往配置模式:

    Arista# config terminal
    
  3. 为交换机提供以下配置,以将日志发送到 Bindplane 代理。

    Arista(config)# logging host <bindplane-server-ip> <port-number> protocol [tcp/udp]
    Arista(config)# logging trap information
    Arista(config)# copy running-config startup-config
    
    * Replace `<bindplane-server-ip>` with Bindplane agent IP address and `<port-number>` with the port configured to listen.
    
  4. 为命令执行日志输入其他配置:

    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
    
  5. 为登录日志输入其他配置:

    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.iptarget.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.hostnameprincipal.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.ipprincipal.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.severitysecurity_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.ipprincipal.asset.ip 直接从 source_ip 字段映射而来,该字段是使用 Grok 模式从 message 字段中提取的。
source_port principal.port 直接从 source_port 字段映射而来,该字段是使用 Grok 模式从 message 字段中提取的。
src_ip principal.ipprincipal.asset.ip 直接从 src_ip 字段映射而来,该字段是使用 Grok 模式从 message 字段中提取的。
table_name target.resource.name 直接从 table_name 字段映射而来,该字段是使用 Grok 模式从 message 字段中提取的。如果填充此字段,target.resource.resource_type 会设置为“TABLE”。
target_host target.hostnametarget.asset.hostname 直接从 target_host 字段映射而来,该字段是使用 Grok 模式从 message 字段中提取的。
target_ip target.iptarget.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_principalhas_targetusermessageproduct_event_typedescription 字段的组合派生而来。默认值为“GENERIC_EVENT”。已硬编码为“ARISTA_SWITCH”。已硬编码为“Arista Switch”。已硬编码为“Arista”。如果 description 字段包含“连接被拒绝”,则设置为“屏蔽”。
dpid additional.fields[DPID].string_value 直接从 dpid 字段映射。
intf additional.fields[intf].string_value 直接从 intf 字段映射。

变化

2024-06-07

增强功能

  • 添加了 Grok 模式,用于解析新的 SYSLOG 格式日志模式。
  • 将“principal_mac”映射到“principal.mac”。
  • 将“principal_port”映射到“principal.port”。

2024-03-17

增强功能

  • 添加了 Grok 模式来解析 SYSLOG 格式日志。
  • 将“user”映射到“principal.user.userid”。
  • 将“proto”映射到“network.application_protocol”。
  • 将“prin_ip”映射到“principal.ip”。

2022-08-03

  • 新创建的解析器。

需要更多帮助?向社区成员和 Google SecOps 专业人士寻求解答。