共用方式為


使用診斷設定導出數據

本文將逐步解說許多可用的選項,以在傳統 Application Insights 資源上啟用診斷設定。

注意

只有在您先前已在傳統Application Insights資源上設定連續匯出時,才能使用傳統ApplicationInsights上的診斷設定。 如果您想要在沒有現有的連續匯出的情況下設定導出的診斷設定,您必須先移轉至 Workspace Application Insights。

警告

從 2024 年 4 月 29 日開始,結束 2024 年 5 月 1 日,持續匯出將會進行維護,以準備關閉。 在此期間,將無法使用連續匯出。 在這段期間導出的任何數據,都會在 2024 年 5 月 1 日維護期間結束時匯出。 視您要匯出的數據量而定,最多可能需要 72 小時才能完全復原。

診斷設定可讓您設定數據匯出,以與現有的連續匯出組態並存執行。 這些設定也會在移轉之後,傳遞給以工作區為基礎的 Application Insights 資源。

重要

使用 Azure 入口網站啟用診斷設定

注意

只有在您先前已在傳統Application Insights資源上設定連續匯出時,才能使用 Azure 入口網站中的診斷設定。 如果您想要在沒有現有的連續匯出的情況下設定導出的診斷設定,您必須先移轉至 Workspace Application Insights。

  1. 在您的傳統 Application Insights 資源內,流覽至 [屬性] 選項。
  2. 在 [ 與連續匯出標題並存啟用診斷設定 ] 底下*,* 選取 [啟用診斷設定]
  3. 從彈出視窗中,選取 [ 套用]。
  4. 一旦您收到最終確認彈出視窗,就會在您的資源內啟用 [診斷設定] 選項,而且您可以將匯出設定為與目前的 [連續匯出] 設定並存執行。

使用ARM樣本啟用診斷設定

準備 ARM 範本,以在傳統 AI 資源上啟用診斷設定,並將 ARM 範本部署至所需的資源群組。

{
    "$schema": https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#,
    "contentVersion": "1.0.0.0",
    "variables": {},
    "resources": [
        {
            "type": "microsoft.insights/components",
            "apiVersion": "2020-02-02",
            "name": "<resource-name>",
            "location": "<resource-location>",
            "properties": {
                "IngestionMode": "ApplicationInsightsWithDiagnosticSettings"
            }
        }
    ]
}

ARM 範本可以透過 Azure 入口網站、Azure CLI 和 Azure PowerShell 進行部署。

下列連結說明完成這項工作的一些熱門方式。

使用 Azure CLI 啟用診斷設定

您可以使用下列 Azure CLI 腳本來啟用診斷設定。

az account set --subscription "<subscription-id>"
az deployment group create --name EnableDiagnosticSettings --resource-group <resource-group-name> --template-file <path-to-template>

確認已啟用診斷設定

停用時, 診斷設定 不會出現在 [監視] 底下。

遵循本文先前的指示並重新整理 Application Insights 資源頁面之後,您可以按兩下 [監視] 下的 [診斷設定] 來設定診斷設定。