收集 Windows Hyper-V 日志

支持范围:

本文档介绍了如何使用 Bindplane 将 Windows Hyper-V 日志注入 Google Security Operations。

Windows Hyper-V 是 Microsoft 的 Hypervisor,可生成虚拟机生命周期、网络、存储和安全性事件日志。Bindplane 代理会直接从本地文件系统收集导出的 Hyper-V 事件日志文件。

准备工作

请确保满足以下前提条件:

  • Google SecOps 实例
  • Windows Server 2016 或更高版本,支持 observiq-otel-collector 服务
  • 如果在代理后面运行,请确保按照 Bindplane 代理要求打开防火墙端口
  • 对 Windows Hyper-V 主机的特权访问权限(具有管理员权限)

获取 Bindplane 代理的 Google SecOps 凭证

如需向 Google SecOps 验证 Bindplane 代理,请选择以下方法之一:

  • 新部署:使用 Chronicle API(选项 1)。
  • 旧版部署:继续使用数据注入身份验证文件(方法 2),直到 Ingestion API 于 2027 年 7 月 20 日停用。
  1. 登录 Google Cloud 控制台,然后选择与您的 Google SecOps 实例关联的 Google Cloud 项目。
  2. 依次前往 IAM 和管理 > 服务账号。
  3. 点击创建服务账号。
  4. 提供以下配置详细信息:
    • 服务账号名称:输入账号的名称(例如 bindplane-ingest)。
    • 服务账号说明:输入说明(例如 Bindplane agent log ingestion)。
  5. 点击创建并继续。
  6. 在向此服务账号授予对项目的访问权限部分,点击选择角色,然后选择 Chronicle Editor。
  7. 点击继续,然后点击完成。
  8. 点击您创建的服务账号,然后前往密钥标签页。
  9. 依次点击添加密钥 > 创建新密钥。
  10. 选择 JSON,然后点击创建。密钥文件会下载到您的计算机上。
  11. 将密钥文件另存为 Bindplane 收集器目录(Linux 上的 /opt/observiq-otel-collector/ingestion-auth.json 或 Windows 上的 C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json)中的 ingestion-auth.json,或更新 config.yaml 中的 creds_file_path 以匹配您保存它的路径。
  12. 前往 IAM 和管理 > 设置,然后复制项目编号。您在配置导出器时需要用到该名称。

方法 2:下载数据注入身份验证文件(旧版)

  1. 登录 Google SecOps 控制台。
  2. 依次前往设置 > 数据管理 > 收集代理。如果您使用的是仅限 SIEM 的平台,请依次前往设置 > 收集代理。
  3. 下载数据注入身份验证文件。
  4. 将该文件安全地保存在将要安装 Bindplane 代理的系统上。

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次前往设置 > 管理 > 个人资料。如果您使用的是仅限 SIEM 的平台,请依次前往设置 > 个人资料。
  3. 复制并保存组织详细信息部分中的客户 ID。

安装 Bindplane 代理

按照以下说明在 Windows 操作系统上安装 Bindplane 代理。

Windows 安装

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

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    
  3. 等待安装完成。

  4. 运行以下命令,验证安装是否成功:

    sc query observiq-otel-collector
    

该服务应显示为正在运行。

其他安装资源

如需了解其他安装选项和问题排查,请参阅 Bindplane 代理安装指南。

配置 Bindplane 代理以注入日志并发送到 Google SecOps

找到配置文件

  • Windows:

    notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
    

修改配置文件

  • 将 config.yaml 的全部内容替换为以下配置:

    receivers:
      filelog:
        include:
          - C:\HyperVLogs\*.evtx
        start_at: beginning
    
    exporters:
      chronicle/windows_hyperv:
        protocol: https
        # Region of your instance, for example us, europe, asia-southeast1
        location: <LOCATION>
        # Project number of the Google Cloud project linked to the instance
        project: '<PROJECT_NUMBER>'
        compression: gzip
        creds_file_path: 'C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json'
        customer_id: '<customer_id>'
        endpoint: chronicle.googleapis.com
        log_type: WINDOWS_HYPERV
        raw_log_field: body
        ingestion_labels:
          env: production
    
    service:
      pipelines:
        logs/hyperv_to_chronicle:
          receivers:
            - filelog
          exporters:
            - chronicle/windows_hyperv
    

配置参数

替换以下占位符:

  • 接收器配置:

    • filelog:用于从磁盘收集日志文件的接收器类型
    • include:要监控的文件路径列表。将此值设置为您导出 Hyper-V 事件日志的位置(例如 C:\HyperVLogs\*.evtx)
    • start_at:设置为 beginning 可读取现有日志,设置为 end 可仅读取新条目
  • 导出器配置:

    • windows_hyperv:导出器的描述性名称
    • creds_file_path:服务账号 JSON 密钥文件的完整路径(选项 1):
      • Windows:C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
    • <customer_id>:上一步中的客户 ID
    • location:将 <LOCATION> 替换为 Google SecOps 实例所在的区域(例如 us、europe 或 asia-southeast1)。导出工具会在此值前面加上 chronicle.googleapis.com。如需查看完整列表,请参阅区域级端点。
    • project:将 <PROJECT_NUMBER> 替换为 IAM 和管理 > 设置中的项目编号。
    • endpoint:保持设置为 chronicle.googleapis.com。
    • WINDOWS_HYPERV:日志类型,与 Chronicle 中显示的完全一致
    • ingestion_labels:YAML 格式的可选标签(例如 env: production)
  • 流水线配置:

    • hyperv_to_chronicle:流水线的描述性名称

旧版提取 API 导出工具

  • 如果您使用选项 2 中的数据注入身份验证文件,请将 exporters 代码块替换为以下内容。将 creds_file_path 设置为数据注入身份验证文件的路径,如果您的实例位于美国境外,请将 malachiteingestion-pa.googleapis.com 替换为您的区域端点(例如 europe-malachiteingestion-pa.googleapis.com)。

    exporters:
      chronicle/windows_hyperv:
        compression: gzip
        creds_file_path: 'C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json'
        customer_id: '<customer_id>'
        endpoint: malachiteingestion-pa.googleapis.com
        log_type: WINDOWS_HYPERV
        raw_log_field: body
        ingestion_labels:
          env: production
    

保存配置文件

  • 修改后,保存文件:
    • Windows:依次点击文件 > 保存

重启 Bindplane 代理以应用更改

如需在 Windows 中重启 Bindplane 代理,请执行以下操作:

  1. 请从下列选项中选择一项:

    • 以管理员身份运行命令提示符或 PowerShell:
    net stop observiq-otel-collector && net start observiq-otel-collector
    
    • 服务控制台:
      1. 按 Win+R,输入 services.msc,然后按 Enter 键。
      2. 找到 observIQ OpenTelemetry 收集器。
      3. 右键点击并选择重启。
  2. 验证服务是否正在运行:

    sc query observiq-otel-collector
    
  3. 检查日志中的错误:

    type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
    

配置 Windows Hyper-V 日志导出

Windows Hyper-V 日志会存储为 Windows 事件日志条目。您需要将这些日志导出到磁盘上的文件中,以便 Bindplane 代理可以收集它们。

  1. 创建一个目录来存储导出的日志文件:

    mkdir C:\HyperVLogs
    
  2. 使用 wevtutil 导出 Hyper-V 事件日志:

    wevtutil epl Microsoft-Windows-Hyper-V-VMMS-Admin C:\HyperVLogs\hyperv-vmms-admin.evtx
    wevtutil epl Microsoft-Windows-Hyper-V-Worker-Admin C:\HyperVLogs\hyperv-worker-admin.evtx
    

    您可以根据需要导出其他 Hyper-V 事件通道。可用渠道包括:

    • Microsoft-Windows-Hyper-V-VMMS-Admin(虚拟机管理服务)
    • Microsoft-Windows-Hyper-V-Worker-Admin(虚拟机工作器进程)
    • Microsoft-Windows-Hyper-V-Hypervisor-Admin(Hypervisor 事件)
    • Microsoft-Windows-Hyper-V-Config-Admin(配置事件)
  3. (可选)使用 PowerShell 安排定期导出:

    $action = New-ScheduledTaskAction -Execute "cmd.exe" -Argument '/c wevtutil epl Microsoft-Windows-Hyper-V-VMMS-Admin C:\HyperVLogs\hyperv-vmms-admin.evtx /ow:true && wevtutil epl Microsoft-Windows-Hyper-V-Worker-Admin C:\HyperVLogs\hyperv-worker-admin.evtx /ow:true'
    $trigger = New-ScheduledTaskTrigger -RepetitionInterval (New-TimeSpan -Hours 1) -Once -At (Get-Date)
    Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "ExportHyperVLogs" -Description "Export Hyper-V logs for Bindplane agent"
    
  4. 验证导出的日志文件是否已在 `C:\HyperVLogs` 中创建。

  5. 确保 config.yaml 中的 Bindplane 代理 include 路径与导出目录匹配。

UDM 映射表

日志字段 UDM 映射 逻辑
channel, event_data.data, event_id.id, event_id.qualifiers, keywords, task, SeverityValue, OpcodeValue, EventID, ProviderGuid, ActivityId, Version, RecordNumber, ProcessID, ThreadID, Channel, AccountName, UserID, AccountType, Opcode, SourceModuleName, SourceModuleType additional.fields 已与根据这些字段创建的标签合并
system_time, EventReceivedTime metadata.collected_timestamp 从 system_time(采用格式)或 EventReceivedTime(采用 UNIX 或 UNIX_MS)解析
消息 metadata.description 直接复制的值
EventTime、EventReceivedTime metadata.event_timestamp 从 EventTime(UNIX 或 UNIX_MS)或 EventReceivedTime(UNIX 或 UNIX_MS)解析
metadata.event_type 如果 has_principal 且 has_target_process,则设置为“PROCESS_LAUNCH”;如果 has_principal 且 has_target 且 not has_target_process,则设置为“USER_LOGIN”;如果 has_principal 且 not has_target,则设置为“STATUS_UPDATE”;如果 has_target,则设置为“USER_RESOURCE_ACCESS”;否则设置为“GENERIC_EVENT”
provider.event_source metadata.product_event_type 直接复制的值
record_id, RecordNumber metadata.product_log_id 如果 record_id 不为空,则从 record_id 转换为字符串;如果 RecordNumber 不为空,则从 RecordNumber 转换为字符串
provider.name, SourceName metadata.product_name provider.name 的值(如果不为空),否则为 SourceName 的值(如果不为空),否则为“Microsoft-Windows-Hyper-V”
版本 metadata.product_version 已转换为字符串
消息 network.session_duration.nanos 使用 grok 模式从消息中提取,并转换为整数
网域 principal.administrative_domain 直接复制的值
计算机 principal.asset.hostname 直接复制的值
计算机、主机名 principal.hostname 计算机中的值(如果不为空),然后是主机名中的值(如果不为空)
AccountName principal.user.role_description 直接复制的值
AccountType principal.user.role_name 直接复制的值
event_data.name principal.user.user_display_name 直接复制的值
security.user_id、UserID principal.user.userid security.user_id 中的值(如果不为空),然后是 UserID 中的值(如果不为空)
消息 security_result.description 使用 grok 模式从消息中提取
message, ActivityId security_result.detection_fields 已与使用 grok 从消息中提取的 nt_status 标签以及 ActivityId 标签合并
级别、严重程度 security_result.severity 根据级别值(1-3 INFORMATIONAL、4 ERROR、5 CRITICAL,其他为 UNKNOWN_SEVERITY)或严重级别(INFO INFORMATIONAL、WARN MEDIUM、ERROR ERROR)进行设置
EventType security_result.severity_details 直接复制的值
execution.process_id, ProcessID target.process.pid 如果 execution.process_id 不为空,则从 execution.process_id 转换为字符串;如果 ProcessID 不为空,则从 ProcessID 转换为字符串
execution.thread_id, ThreadID target.process.product_specific_process_id 如果 execution.thread_id 不为空,则设置为“ThreadID: ”(来自 execution.thread_id);如果 ThreadID 不为空,则设置为“ThreadID: ”(来自 ThreadID)
provider.guid, ProviderGuid target.resource.id 移除 { } 后的 provider.guid 值,或移除 { } 后的 ProviderGuid 值
消息 target.resource.product_object_id 使用 grok 模式从消息中提取
provider.guid target.resource.type 如果非空,则设置为“Hyper-V VmSwitch”

更新日志

查看此解析器的更新日志

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