收集 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),直到注入 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 收集器目录中的 ingestion-auth.json(在 Linux 上为 /opt/observiq-otel-collector/ingestion-auth.json,在 Windows 上为 C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json),或者更新 creds_file_path 在 config.yaml 中以与您保存该文件的路径匹配。
  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
    

该服务应显示为 RUNNING 。

其他安装资源

如需了解其他安装选项和问题排查信息,请参阅 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 Collector 。
      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 解析,或以 UNIX 或 UNIX_MS 格式从 EventReceivedTime 解析
消息 metadata.description 直接复制值
EventTime、EventReceivedTime metadata.event_timestamp 以 UNIX 或 UNIX_MS 格式从 EventTime 解析,或以 UNIX 或 UNIX_MS 格式从 EventReceivedTime 解析
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 不为空,则取自 provider.name;否则,如果 SourceName 不为空,则取自 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 不为空,则取自 security.user_id;否则,如果 UserID 不为空,则取自 UserID
消息 security_result.description 使用 grok 模式从消息中提取
消息、ActivityId security_result.detection_fields 与使用 grok 从消息中提取的 nt_status 标签以及 ActivityId 合并
level、Severity 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: ”;否则,如果 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 专业人士的解答。