收集 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. /path/to/ingestion-authentication-file.json 更新为获取 Google SecOps 提取身份验证文件部分中保存身份验证文件的路径。

重启 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 字段包含“connection rejected”,则设置为“BLOCK”。
dpid additional.fields[DPID].string_value 直接从 dpid 字段映射。
intf additional.fields[intf].string_value 直接从 intf 字段映射。

需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。