收集 Security Command Center 错误日志

支持的语言:

本文档介绍了如何使用 Cloud Storage 将 Security Command Center 错误日志导出并注入到 Google Security Operations 中。解析器会将原始 JSON 格式的日志转换为统一数据模型 (UDM)。它从原始日志中提取相关字段,执行数据清理和归一化,并根据 UDM 架构构建输出,以实现一致的安全分析。

准备工作

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

  • Security Command Center 已在您的 Google Cloud 环境中启用和配置。
  • Google SecOps 实例。
  • 对 Security Command Center 和 Cloud Logging 的特权访问权限。

创建 Cloud Storage 存储桶

  1. 登录 Google Cloud 控制台
  2. 前往 Cloud Storage 存储分区页面。

    进入“存储桶”

  3. 点击创建

  4. 创建存储桶页面上,输入您的存储桶信息。完成以下每一步后,点击继续以继续执行后续步骤:

    1. 开始使用部分中,执行以下操作:

      1. 输入符合存储桶名称要求的唯一名称,例如 gcp-scc-error-logs
      2. 如需启用分层命名空间,请点击展开箭头以展开优化文件导向型和数据密集型工作负载部分,然后选择在此存储桶上启用分层命名空间

      3. 如需添加存储桶标签,请点击展开箭头以展开标签部分。

      4. 点击添加标签,然后为标签指定键和值。

    2. 选择数据存储位置部分中,执行以下操作:

      1. 选择位置类型
      2. 使用位置类型菜单选择一个位置,用于永久存储存储桶中的对象数据。

      3. 如需设置跨存储桶复制,请展开设置跨存储桶复制部分。

    3. 为数据选择一个存储类别部分中,为存储桶选择默认存储类别,或者选择 Autoclass 对存储桶数据进行自动存储类别管理。

    4. 选择如何控制对对象的访问权限部分中,选择强制执行禁止公开访问,然后为存储桶对象选择访问权限控制模型

    5. 选择如何保护对象数据部分中,执行以下操作:

      1. 数据保护下,选择您要为存储桶设置的任何选项。
      2. 如需选择对象数据的加密方式,请点击标有数据加密的展开箭头,然后选择数据加密方法
  5. 点击创建

配置 Security Command Center 日志记录

  1. 登录 Google Cloud 控制台
  2. 前往 Security Command Center 页面。

    进入 Security Command Center

  3. 选择您的组织。

  4. 点击设置

  5. 点击连续导出标签页。

  6. 导出名称下,点击 Logging 导出

  7. 接收器下,开启将发现结果记录到 Logging

  8. 记录项目下,输入或搜索要在其中记录发现结果的项目。

  9. 点击保存

配置 Security Command Center 错误日志导出

  1. 登录 Google Cloud 控制台
  2. 前往日志记录 > 日志路由器
  3. 点击创建接收器
  4. 提供以下配置参数:

    • 接收器名称:输入一个有意义的名称,例如 scc-error-logs-sink
    • 接收器目标位置:选择 Cloud Storage 存储空间,然后输入存储桶的 URI,例如 gs://gcp-scc-error-logs
    • 日志过滤条件

      logName="projects/<your-project-id>/logs/cloudsecurityscanner.googleapis.com%2Ferror_logs"
       resource.type="security_command_center_error"
      
    • 设置导出选项:包含所有日志条目。

  5. 点击创建

配置 Cloud Storage 权限

  1. 前往 IAM 和管理> IAM
  2. 找到 Cloud Logging 服务账号。
  3. 授予对相应存储桶的 roles/storage.admin

设置 Feed

您可以通过两种不同的入口点在 Google SecOps 平台中设置 Feed:

  • SIEM 设置 > Feed
  • 内容中心 > 内容包

通过“SIEM 设置”>“Feed”设置 Feed

如需配置 Feed,请按以下步骤操作:

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称,例如 Security Command Center 错误日志
  5. 选择 Google Cloud Storage 作为来源类型
  6. 选择 Security Command Center 错误作为日志类型
  7. 点击Chronicle 服务账号字段旁边的获取服务账号
  8. 点击下一步
  9. 为以下输入参数指定值:

    • 存储分区 URI:Cloud Storage 存储桶网址;例如 gs://gcp-scc-error-logs
    • URI Is A:选择目录(包括子目录)
    • 来源删除选项:根据您的偏好设置选择删除选项。

  10. 点击下一步

  11. 最终确定界面中查看新的 Feed 配置,然后点击提交

设置来自内容中心的 Feed

为以下字段指定值:

  • 存储分区 URI:Cloud Storage 存储桶网址;例如 gs://gcp-scc-error-logs
  • URI Is A:选择目录(包括子目录)
  • 来源删除选项:根据您的偏好设置选择删除选项。

高级选项

  • Feed 名称:用于标识 Feed 的预填充值。
  • 来源类型:用于将日志收集到 Google SecOps 中的方法。
  • 资源命名空间:与 Feed 关联的命名空间。
  • 提取标签:应用于相应 Feed 中所有事件的标签。

UDM 映射表

日志字段 UDM 映射 逻辑
access.principalEmail about.user.email_addresses access.principalEmail 字段中获取的值。
类别 metadata.product_event_type 根据日志格式,从 categoryfindings.category 字段中获取的值。
contacts.security.contacts.email security_result.about.user.email_addresses contacts.security.contacts.email 字段中获取的值。角色设置为 Security
contacts.technical.contacts.email security_result.about.user.email_addresses contacts.technical.contacts.email 字段中获取的值。角色设置为 Technical
createTime security_result.detection_fields.value 根据日志格式,从 createTimefindings.createTime 字段中获取的值。该键设置为 createTime
说明 security_result.description 根据日志格式,从 descriptionfindings.description 字段中获取的值。
eventTime metadata.event_timestamp 根据日志格式从 eventTimefindings.eventTime 字段中提取的值,并转换为时间戳。
externalUri about.url 根据日志格式,从 externalUrifindings.externalUri 字段中获取的值。
findingClass security_result.category_details 根据日志格式,从 findingClassfindings.findingClass 字段中获取的值。
findingProviderId target.resource.attribute.labels.value 根据日志格式,从 findingProviderIdfindings.findingProviderId 字段中获取的值。该键设置为 finding_provider_id
mute security_result.detection_fields.value 根据日志格式,从 mutefindings.mute 字段中获取的值。该键设置为 mute
nextSteps security_result.outcomes.value 根据日志格式,从 nextStepsfindings.nextSteps 字段中获取的值。该键设置为 nextSteps
resourceName target.resource.name 根据日志格式,从 resourceNamefindings.resourceNameresource_namefindings.resource_name 字段中获取的值。
securityMarks.name security_result.detection_fields.value 根据日志格式,从 securityMarks.namefindings.securityMarks.name 字段中获取的值。该键设置为 securityMarks_name
和程度上减少 security_result.severity 根据日志格式从 severityfindings.severity 字段中获取值,并将其映射到相应的 UDM 严重程度级别。
sourceDisplayName target.resource.attribute.labels.value 根据日志格式,从 sourceDisplayNamefindings.sourceDisplayName 字段中获取的值。该键设置为 source_display_name
sourceProperties.ReactivationCount target.resource.attribute.labels.value 根据日志格式,从 sourceProperties.ReactivationCountfindings.sourceProperties.ReactivationCount 字段中获取的值。该键设置为 sourceProperties_ReactivationCount
state security_result.detection_fields.value 根据日志格式,从 statefindings.state 字段中获取的值。该键设置为 state
metadata.event_type 默认设置为 GENERIC_EVENT
metadata.log_type 硬编码的值 GCP_SECURITYCENTER_ERROR
metadata.description 硬编码的值 Security Command Center
metadata.product_name 硬编码的值 Security Command Center
metadata.vendor_name 硬编码的值 Google
target.resource.attribute.labels.key 硬编码的值 finding_id
target.resource.attribute.labels.value namefindings.name 字段中提取,捕获最后一个 / 字符后的最后一部分。
target.resource.product_object_id parentfindings.parent 字段中提取,捕获最后一个 / 字符之后的值。
target.resource.ancestors.name 根据日志格式,从 parentfindings.parent 字段中获取的值。
target.resource_ancestors.name resourceNamefindings.resourceName 字段中提取,捕获 //cloudresourcemanager.googleapis.com/projects/ 前缀后面的值。
target.resource_ancestors.resource_type 硬编码的值 CLOUD_PROJECT
target.resource.attribute.labels.key 硬编码的值 source_id
target.resource.attribute.labels.value parentfindings.parent 字段中提取,捕获第二个 / 字符后的值。
security_result.alert_state 根据 statefindings.state 字段进行映射。如果状态为 ACTIVE,则将 alert_state 设置为 ALERTING,否则设置为 NOT_ALERTING
about.user.email_addresses iamBindings.member 字段中获取的值。
about.user.attribute.roles.name 硬编码的值 Security

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