收集 Google Cloud 運算內容記錄

支援的國家/地區:

本文說明如何使用 Cloud Storage,將 Compute 內容記錄檔匯出及擷取 Google Cloud 至 Google Security Operations。剖析器會從 JSON 格式的記錄檔中擷取資訊。接著,系統會將擷取的資料正規化並轉換為 Google SecOps UDM 格式,著重於虛擬機器的詳細資料,例如硬體規格、網路設定、安全性設定,以及與其他實體的關係。

事前準備

請確認您已完成下列事前準備事項:

  • Google SecOps 執行個體。
  • 在 Google Cloud 環境中設定並啟用 Compute。
  • Google Cloud 的特殊存取權和適當權限。

建立 Cloud Storage 值區

  1. 登入Google Cloud 控制台
  2. 前往「Cloud Storage Buckets」(Cloud Storage bucket) 頁面。

    前往「Buckets」(值區) 頁面

  3. 點選「建立」

  4. 在「建立 bucket」頁面中,輸入 bucket 資訊。完成下列每個步驟後,請按一下「繼續」前往下一個步驟:

    1. 在「開始使用」部分,執行下列操作:

      1. 輸入符合值區名稱規定的專屬名稱,例如 compute-context-logs
      2. 如要啟用階層命名空間,請按一下展開箭頭,展開「為檔案導向和資料密集型工作負載提供最理想的儲存空間」部分,然後選取「為這個值區啟用階層結構式命名空間」

      3. 如要新增值區標籤,請按一下展開箭頭,展開「標籤」部分。

      4. 按一下「新增標籤」,然後指定標籤的鍵和值。

    2. 在「Choose where to store your data」(選擇資料的儲存位置) 專區中,執行下列操作:

      1. 選取「位置類型」
      2. 使用位置類型選單選取位置,永久儲存 bucket 中的物件資料。

      3. 如要設定跨 bucket 複製作業,請展開「設定跨 bucket 複製作業」部分。

    3. 在「Choose a storage class for your data」(為資料選擇儲存空間級別) 專區中,選取 bucket 的預設儲存空間級別,或選取「Autoclass」(自動分類),讓系統自動管理 bucket 資料的儲存空間級別。

    4. 在「選取如何控制物件的存取權」部分,選取「否」以強制禁止公開存取,並為值區物件選取存取權控管模型

    5. 在「選擇保護物件資料的方式」部分,請執行下列操作:

      1. 選取「資料保護」下方的任何選項,為 bucket 設定資料保護措施。
      2. 如要選擇物件資料的加密方式,請按一下標示為「資料加密」的展開箭頭,然後選取「資料加密方法」
  5. 點選「建立」

設定 Google Cloud 運算記錄匯出作業

  1. 登入Google Cloud 控制台
  2. 依序前往「Logging」>「Log Router」
  3. 按一下「建立接收器」
  4. 提供下列設定參數:

    • 接收器名稱:輸入有意義的名稱,例如 Compute-Context-Sink
    • 接收器目的地:選取「Cloud Storage Storage」,然後輸入值區的 URI,例如 gs://compute-context-logs
    • 記錄檔篩選器

      logName="*compute*"
      resource.type="gce_instance"
      
  5. 點選「建立」

設定 Cloud Storage 的權限

  1. 前往「IAM 與管理」>「IAM」
  2. 找到 Cloud Logging 服務帳戶。
  3. 授予值區的 roles/storage.admin

設定動態饋給

在 Google SecOps 平台中,有兩種不同的進入點可設定動態饋給:

  • 依序點選「SIEM 設定」>「動態饋給」>「新增」
  • 依序點選「內容中心」「內容包」「開始使用」

如何設定 Google Cloud 運算環境動態饋給

  1. 按一下「Google Cloud Compute platform」套件。
  2. 找出 GCP Compute Context 記錄類型。
  3. 指定下列值:

    • 來源類型:Google Cloud Storage V2。
    • 儲存空間值區 URI:Cloud Storage 值區網址,例如 gs://compute-context-logs
    • 來源刪除選項:根據偏好選取刪除選項。

    • 檔案存在時間上限:在過去幾天內修改的檔案。預設值為 180 天。

    • Chronicle 服務帳戶:複製服務帳戶。您需要這項資訊,才能在 Bucket 中新增這項服務帳戶的權限,讓 Google SecOps 讀取或刪除 Bucket 中的資料。

    進階選項

    • 動態饋給名稱:系統預先填入的值,用於識別動態饋給。
    • 資產命名空間:與動態饋給相關聯的命名空間。
    • 擷取標籤:套用至這個動態饋給所有事件的標籤。
  4. 點選「建立動態饋給」

如要進一步瞭解如何為這個產品系列中的不同記錄類型設定多個動態饋給,請參閱「依產品設定動態饋給」。

UDM 對應表

記錄欄位 UDM 對應 邏輯
上階 event.idm.entity.entity.asset.attribute.labels.value 祖先陣列中的每個祖先值都會對應到具有 ancestors 鍵的個別標籤。
assetType event.idm.entity.entity.asset.category 直接從 assetType 欄位對應。
asset_type event.idm.entity.entity.asset.category 直接從 asset_type 欄位對應。
名稱 event.idm.entity.entity.resource.name 直接從名稱欄位對應。
resource.data.cpuPlatform event.idm.entity.entity.asset.hardware.cpu_platform 直接從 resource.data.cpuPlatform 欄位對應。
resource.data.creationTimestamp event.idm.entity.entity.asset.attribute.creation_time 從 resource.data.creationTimestamp 欄位剖析為時間戳記格式。
resource.data.id event.idm.entity.entity.asset.product_object_id 直接從 resource.data.id 欄位對應。
resource.data.labels.business_function event.idm.entity.entity.asset.attribute.labels.value 直接從 resource.data.labels.business_function 欄位對應,並將鍵設為 business_function
resource.data.labels.environment event.idm.entity.entity.asset.attribute.labels.value 直接從 resource.data.labels.environment 欄位對應,並將鍵設為 environment
resource.data.labels.infra_location event.idm.entity.entity.asset.attribute.labels.value 直接從 resource.data.labels.infra_location 欄位對應,並將鍵設為 infra_location
resource.data.labels.instance_group event.idm.entity.user.group_identifiers 直接從 resource.data.labels.instance_group 欄位對應。
resource.data.labels.os event.idm.entity.entity.asset.platform_software.platform_version 直接從 resource.data.labels.os 欄位對應。
resource.data.labels.primary_application event.idm.entity.entity.asset.attribute.labels.value 直接從 resource.data.labels.primary_application 欄位對應,且鍵設為 primary_application
resource.data.labels.project_code event.idm.entity.entity.asset.attribute.labels.value 直接從 resource.data.labels.project_code 欄位對應,並將鍵設為 project_code
resource.data.lastStartTimestamp event.idm.entity.entity.asset.last_boot_time 從 resource.data.lastStartTimestamp 欄位剖析為時間戳記格式。
resource.data.machineType event.idm.entity.entity.asset.hardware.model 系統會使用規則運算式,從 resource.data.machineType 欄位擷取機器類型。
resource.data.name event.idm.entity.entity.asset.hostname 直接從 resource.data.name 欄位對應。
resource.data.networkInterfaces.0.accessConfigs.0.natIP event.idm.entity.entity.asset.nat_ip 系統會對應第一個網路介面的第一個 NAT IP 位址。
resource.data.networkInterfaces.0.network event.idm.entity.entity.asset.attribute.cloud.vpc.name 網路 ID 是使用規則運算式,從 resource.data.networkInterfaces.0.network 欄位中擷取而來。
resource.data.networkInterfaces.0.networkIP event.idm.entity.entity.asset.ip 系統會對應第一個網路介面的 IP 位址。
resource.data.networkInterfaces.1.networkIP event.idm.entity.entity.asset.ip 第二個網路介面的 IP 位址已對應。
resource.data.selfLink event.idm.entity.entity.url 直接從 resource.data.selfLink 欄位對應。
resource.data.serviceAccounts.0.email event.idm.entity.relations.entity.user.email_addresses 第一個服務帳戶的電子郵件地址已對應。
resource.data.status event.idm.entity.entity.asset.deployment_status 如果狀態為 RUNNINGPROVISIONINGSTAGINGSTOPPINGSUSPENDINGSUSPENDEDREPAIRINGTERMINATED,則會對應至 ACTIVE。否則會對應至 DEPLOYMENT_STATUS_UNSPECIFIED
event.idm.entity.entity.asset.attribute.cloud.availability_zone 可用區是由地區和 zone_suffix 欄位組合而成。
event.idm.entity.entity.asset.attribute.cloud.environment 設為 GOOGLE_CLOUD_PLATFORM
event.idm.entity.entity.asset.attribute.cloud.project.name 系統會使用規則運算式,從名稱欄位擷取專案 ID。
event.idm.entity.entity.asset.attribute.cloud.project.resource_type 設為 CLOUD_PROJECT
event.idm.entity.entity.asset.attribute.cloud.vpc.resource_type 設為 VPC_NETWORK
event.idm.entity.entity.resource.resource_type 如果 asset_type 或 assetType 包含 Instance,請設為 VIRTUAL_MACHINE
event.idm.entity.entity.resource.type 如果 asset_type 或 assetType 包含 Instance,請設為 VIRTUAL_MACHINE
event.idm.entity.metadata.collected_timestamp 設為 Logstash 事件時間戳記。
event.idm.entity.metadata.entity_type 設為 ASSET
event.idm.entity.metadata.product_name 設為 GCP Compute Context
event.idm.entity.metadata.vendor_name 設為 Google Cloud Platform
event.idm.entity.relations.entity.user.attribute.cloud.environment 設為 GOOGLE_CLOUD_PLATFORM
event.idm.entity.relations.entity_type 設為 USER
event.idm.entity.relations.relationship 設為 ADMINISTERS

還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。