Auxiliary テーブル プラン を使用すると、Log Analytics ワークスペースにデータを低コストで取り込んで保持できます。
次のビデオでは、Auxiliary テーブル プランのいくつかの用途と利点について説明します。
現在、Azure Monitor ログでは、データ収集ルール (DCR) ベースのカスタム テーブルに対する Auxiliary テーブル プランがサポートされています。このテーブルには Azure Monitor エージェントまたは Logs ingestion API を使用して収集したデータが送信されます。
この記事では、Log Analytics ワークスペースで補助プランを使用して新しいカスタム テーブルを作成し、このテーブルにデータを送信するデータ収集ルールを設定する方法について説明します。 補助プランの概念の詳細については、Azure Monitor ログのテーブル プランを参照してください。
前提条件
カスタム テーブルを作成してログ データを収集するには、次のものが必要です。
- 少なくとも共同作成者権限がある Log Analytics ワークスペース。
- データ収集エンドポイント (DCE)。
- 補助プランを使用したテーブルの設定は、新しいテーブルでのみサポートされます。 補助プランを使ってテーブルを作成した後で、テーブルのプランを切り替えることはできません。
注
補助ログは、すべてのパブリック クラウド リージョンで一般公開 (GA) されますが、Azure Government または China クラウドでは使用できません。
Auxiliary プランを使用してカスタム テーブルを作成する
カスタム テーブルを作成するには、次のコマンドを使用して Tables - Create API を呼び出します。
PUT https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.OperationalInsights/workspaces/{workspace_name}/tables/{table name_CL}?api-version=2023-01-01-preview
注
現時点では、API のバージョン 2023-01-01-preview
を使用した場合にのみ、Auxiliary テーブル プランを設定できます。
このペイロードを要求の本文として指定します。 テーブル名を更新し、テーブル スキーマに基づいて列を調整します。 このサンプルでは、サポートされているすべての列データ型を一覧表示します。
{
"properties": {
"schema": {
"name": "table_name_CL",
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "StringProperty",
"type": "string"
},
{
"name": "IntProperty",
"type": "int"
},
{
"name": "LongProperty",
"type": "long"
},
{
"name": "RealProperty",
"type": "real"
},
{
"name": "BooleanProperty",
"type": "boolean"
},
{
"name": "GuidProperty",
"type": "guid"
},
{
"name": "DateTimeProperty",
"type": "datetime"
}
]
},
"totalRetentionInDays": 365,
"plan": "Auxiliary"
}
}
注
TimeGenerated
列では、有効桁数 (ナノ秒) の小数点以下 6 桁の ISO 8601 形式のみがサポートされます。 詳細については、 サポートされている ISO 8601 datetime 形式を参照してください。- 補助プランのテーブルでは、動的データを含む列はサポートされていません。
Auxiliary プランを使用してテーブルにデータを送信する
現在、Auxiliary プランを使用してカスタム テーブルにデータを取り込む方法は 2 つあります。
Azure Monitor エージェントを使用してテキスト ファイルからログを収集する / Azure Monitor エージェントを使用して JSON ファイルからログを収集する。
この方法を使用する場合、カスタム テーブルには、
TimeGenerated
とRawData
(string
型) という 2 つの列のみが含まれている必要があります。 収集した各ログ エントリの全体をデータ収集ルールでRawData
列に送信し、Azure Monitor ログはログの取り込み時刻をTimeGenerated
列に自動的に設定します。Logs ingestion API を使用して Azure Monitor にデータを送信します。
この方法を使用するには:
この記事の説明に従って、Auxiliary プランを使用してカスタム テーブルを作成します。
「チュートリアル: Logs ingestion API を使用して Azure Monitor にデータを送信する」で説明されている手順に従います。
この ARM テンプレートを使用してデータ収集ルールを作成します。
{ "$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "dataCollectionRuleName": { "type": "string", "metadata": { "description": "Specifies the name of the data collection rule to create." } }, "___location": { "type": "string", "metadata": { "description": "Specifies the region in which to create the data collection rule. The must be the same region as the destination Log Analytics workspace." } }, "workspaceResourceId": { "type": "string", "metadata": { "description": "The Azure resource ID of the Log Analytics workspace in which you created a custom table with the Auxiliary plan." } } }, "resources": [ { "type": "Microsoft.Insights/dataCollectionRules", "name": "[parameters('dataCollectionRuleName')]", "___location": "[parameters('___location')]", "apiVersion": "2023-03-11", "kind": "Direct", "properties": { "streamDeclarations": { "Custom-table_name_CL": { "columns": [ { "name": "TimeGenerated", "type": "datetime" }, { "name": "StringProperty", "type": "string" }, { "name": "IntProperty", "type": "int" }, { "name": "LongProperty", "type": "long" }, { "name": "RealProperty", "type": "real" }, { "name": "BooleanProperty", "type": "boolean" }, { "name": "GuidProperty", "type": "guid" }, { "name": "DateTimeProperty", "type": "datetime" } ] } }, "destinations": { "logAnalytics": [ { "workspaceResourceId": "[parameters('workspaceResourceId')]", "name": "myworkspace" } ] }, "dataFlows": [ { "streams": [ "Custom-table_name_CL" ], "destinations": [ "myworkspace" ] } ] } } ], "outputs": { "dataCollectionRuleId": { "type": "string", "value": "[resourceId('Microsoft.Insights/dataCollectionRules', parameters('dataCollectionRuleName'))]" } } }
どこで:
myworkspace
は、Log Analytics ワークスペースの名前です。table_name_CL
は、テーブルの名前です。columns
には、「Auxiliary プランを使用してカスタム テーブルを作成する」で設定したのと同じ列が含まれます。
次のステップ
各項目の詳細情報