使用 BigQuery Studio 查詢記錄資料

在 BigQuery Studio 中查詢記錄資料時,您可以將記錄與其他業務資料彙整,並使用 BigQuery 專屬的指令、工作流程和資料集。您可以直接從「可觀測性分析」頁面,在 BigQuery Studio 中開啟 SQL 查詢。查詢會自動為連結的 BigQuery 資料集格式化 FROM 子句。

如果您不熟悉 Observability Analytics,請參閱「Observability Analytics 總覽」。

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自體驗產品的實際應用成效。新客戶還能獲得價值 $300 美元的免費抵免額,能用於執行、測試及部署工作負載。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. 如要取得從 BigQuery Studio 查詢連結資料集所需的權限,請要求管理員授予您下列 IAM 角色:

    如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

    您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

  7. 確認記錄檔 bucket 中有連結的 BigQuery 資料集。如果資料集不存在,請建立資料集。

從 BigQuery Studio 執行查詢

如要從「Observability Analytics」頁面開啟 BigQuery,然後查詢記錄資料,請按照下列步驟操作:

  1. 在 Google Cloud 控制台中,前往 「Observability Analytics」(觀測能力分析) 頁面:

    前往「Observability Analytics」(觀測能力分析) 頁面

    如果您是使用搜尋列尋找這個頁面,請選取子標題為「Logging」的結果。

  2. 在「記錄檢視」清單中,找出並選取記錄檢視。

  3. 在「結構定義」窗格中,選取「查詢」。

    「Query」(查詢) 窗格會填入預設查詢。您也可以在「Query」(查詢) 窗格中輸入查詢,或編輯顯示的查詢。

  4. 在工具列中,展開標示為「執行查詢」或「在 BigQuery 中執行」的按鈕,然後選取「在 BigQuery 中開啟」。

    BigQuery Studio 隨即開啟。查詢的FROM陳述式會經過修改,使用 BigQuery Table path syntax 指定連結資料集中的記錄檢視路徑。

    您也可以編輯顯示的查詢。

  5. 在 BigQuery Studio 中,按一下「執行查詢」。

定價

如要瞭解使用 BigQuery 的相關費用,請參閱 BigQuery 定價。

後續步驟