收集 Cloud Storage 上下文日志

支持的语言:

本文档介绍了如何使用 Cloud Storage 将 Cloud Storage 上下文日志导出并注入到 Google Security Operations 中。解析器会清理并结构化来自 Cloud Storage 日志的传入 JSON 数据。然后,它会将相关字段映射到统一数据模型 (UDM),并使用标签和元数据丰富数据,以便在安全生态系统中实现一致的表示和分析。

准备工作

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

  • Google SecOps 实例。
  • Cloud Storage 已在您的 Google Cloud 环境中设置并处于活动状态。
  • 对 Google Cloud 的特许访问权限和适当的权限。

创建 Cloud Storage 存储桶

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

    进入“存储桶”

  3. 点击创建

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

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

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

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

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

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

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

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

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

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

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

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

配置 Cloud Storage 上下文日志导出

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

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

      logName="*storage*"
      resource.type="gcs_bucket"
      
  5. 点击创建

配置 Cloud Storage 权限

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

设置 Feed

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

  • SIEM 设置 > Feed > 添加新 Feed
  • 内容中心 > 内容包 > 开始

如何设置云存储空间上下文 Feed

  1. 点击 Google Cloud Compute 平台包。
  2. 找到 GCP Google Cloud Storage Context 日志类型,然后点击 Add new feed
  3. 为以下字段指定值:

    • 数据源类型Google Cloud Storage V2
    • 存储分区 URI:Cloud Storage 存储桶网址;例如 gs://compute-context-logs
    • 来源删除选项:根据您的偏好设置选择删除选项。
  • 文件存在时间上限:包含在过去指定天数内修改的文件。默认值为 180 天。

高级选项

  • Feed 名称:用于标识 Feed 的预填充值。
  • 资源命名空间:与 Feed 关联的命名空间。
  • 提取标签:应用于相应 Feed 中所有事件的标签。
  1. 点击创建 Feed

如需详细了解如何为相应产品系列中的不同日志类型配置多个 Feed,请参阅按产品配置 Feed

UDM 映射表

日志字段 UDM 映射 逻辑
祖先 event.idm.entity.entity.resource.attribute.labels.value 祖先值是从原始日志中的祖先数组提取的。
assetType event.idm.entity.entity.resource.type 直接从原始日志中的 assetType 字段映射。
insertId event.idm.entity.metadata.product_entity_id 直接从原始日志中的 insertId 字段映射。
labels.compute.googleapis.com/resource_name event.idm.entity.entity.resource.name 直接从原始日志中的 labels.compute.googleapis.com/resource_name 字段映射。
labels.k8s-pod/controller-revision-hash event.idm.entity.entity.file.sha1 直接从原始日志中的 labels.k8s-pod/controller-revision-hash 字段映射。
labels.k8s-pod/name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 labels.k8s-pod/name 字段映射。
labels.k8s-pod/pod-template-generation event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 labels.k8s-pod/pod-template-generation 字段映射。
logName event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 logName 字段映射。
name event.idm.entity.entity.resource.name 直接从原始日志中的名称字段映射。
receiveTimestamp event.idm.entity.entity.resource.attribute.creation_time 根据原始日志中的 receiveTimestamp 字段转换为时间戳格式。
resource.data.iamConfiguration.publicAccessPrevention event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.iamConfiguration.publicAccessPrevention 字段映射。
resource.data.id event.idm.entity.entity.resource.product_object_id 直接从原始日志中的 resource.data.id 字段映射。
resource.data.kind event.idm.entity.entity.resource.type 直接从原始日志中的 resource.data.kind 字段映射。
resource.data.labels.app_id event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.app_id 字段映射。
resource.data.labels.app_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.app_name 字段映射。
resource.data.labels.bucket_id event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.bucket_id 字段映射。
resource.data.labels.data_classification event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.data_classification 字段映射。
resource.data.labels.dept_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.dept_name 字段映射。
resource.data.labels.dept_no event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.dept_no 字段映射。
resource.data.labels.environment event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.environment 字段映射。
resource.data.labels.goog-composer-environment event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.goog-composer-environment 字段映射。
resource.data.labels.goog-composer-location event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.goog-composer-location 字段映射。
resource.data.labels.goog-composer-version event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.goog-composer-version 字段映射。
resource.data.labels.technical_contact event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.technical_contact 字段映射。
resource.data.labels.type event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.data.labels.type 字段映射。
resource.data.location event.idm.entity.entity.location.name 直接从原始日志中的 resource.data.location 字段映射。
resource.data.projectNumber event.idm.entity.entity.resource.attribute.cloud.project.id 直接从原始日志中的 resource.data.projectNumber 字段映射。
resource.data.selfLink event.idm.entity.entity.url 直接从原始日志中的 resource.data.selfLink 字段映射。
resource.data.timeCreated event.idm.entity.entity.resource.attribute.creation_time 从原始日志的 resource.data.timeCreated 字段转换为时间戳格式。
resource.data.updated event.idm.entity.entity.resource.attribute.last_update_time 从原始日志中的 resource.data.updated 字段转换为时间戳格式。
resource.discoveryDocumentUri event.idm.entity.entity.file.full_path 直接从原始日志中的 resource.discoveryDocumentUri 字段映射。
resource.labels.cluster_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.labels.cluster_name 字段映射。
resource.labels.container_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.labels.container_name 字段映射。
resource.labels.location event.idm.entity.entity.location.name 直接从原始日志中的 resource.labels.location 字段映射。
resource.labels.namespace_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.labels.namespace_name 字段映射。
resource.labels.pod_name event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.labels.pod_name 字段映射。
resource.labels.project_id event.idm.entity.entity.resource.attribute.cloud.project.id 直接从原始日志中的 resource.labels.project_id 字段映射。
resource.parent event.idm.entity.entity.resource.parent 直接从原始日志中的 resource.parent 字段映射。
resource.type event.idm.entity.entity.resource.type 直接从原始日志中的 resource.type 字段映射。
resource.version event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 resource.version 字段映射。
textPayload event.idm.entity.entity.resource.attribute.labels.value 直接从原始日志中的 textPayload 字段映射。
不适用 event.idm.entity.metadata.collected_timestamp 收集的时间戳是日志条目时间戳。
不适用 event.idm.entity.metadata.entity_type 硬编码为 RESOURCE
不适用 event.idm.entity.metadata.product_name 硬编码为 GCP Storage Context
不适用 event.idm.entity.metadata.vendor_name 硬编码为 Google Cloud Platform
不适用 event.idm.entity.entity.resource.attribute.cloud.environment 硬编码为 GOOGLE_CLOUD_PLATFORM
不适用 event.idm.entity.entity.resource.resource_type 硬编码为 STORAGE_BUCKET
不适用 event.timestamp 事件时间戳是日志条目时间戳。

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