次の方法で共有


Diagnostic - Create Or Update

新しい診断を作成するか、既存の診断を更新します。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}?api-version=2024-05-01

URI パラメーター

名前 / 必須 説明
diagnosticId
path True

string

minLength: 1
maxLength: 80
pattern: ^[^*#&+:<>?]+$

診断識別子。 現在の API Management サービス インスタンスで一意である必要があります。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

リソース グループの名前。 名前では大文字と小文字が区別されません。

serviceName
path True

string

minLength: 1
maxLength: 50
pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

API Management サービスの名前。

subscriptionId
path True

string (uuid)

ターゲット サブスクリプションの ID。 値は UUID である必要があります。

api-version
query True

string

minLength: 1

この操作に使用する API バージョン。

要求ヘッダー

名前 必須 説明
If-Match

string

エンティティの ETag。 エンティティを作成する場合は必要ありませんが、エンティティを更新する場合は必須です。

要求本文

名前 必須 説明
properties.loggerId True

string

ターゲット ロガーのリソース ID。

properties.alwaysLog

AlwaysLog

適用しないメッセージ サンプリング設定の種類を指定します。

properties.backend

PipelineDiagnosticSettings

バックエンドへの受信/送信 HTTP メッセージの診断設定

properties.frontend

PipelineDiagnosticSettings

ゲートウェイへの受信/送信 HTTP メッセージの診断設定。

properties.httpCorrelationProtocol

HttpCorrelationProtocol

Application Insights 診断に使用する関連付けプロトコルを設定します。

properties.logClientIp

boolean

ClientIP をログに記録します。 既定値は false です。

properties.metrics

boolean

出力メトリック ポリシーを使用してカスタム メトリックを出力します。 Application Insights 診断設定にのみ適用されます。

properties.operationNameFormat

OperationNameFormat

Application Insights テレメトリの操作名の形式。 既定値は Name です。

properties.sampling

SamplingSettings

診断のサンプリング設定。

properties.verbosity

Verbosity

トレース ポリシーによって出力されるトレースに適用される詳細レベル。

応答

名前 説明
200 OK

DiagnosticContract

診断が正常に更新されました

ヘッダー

ETag: string

201 Created

DiagnosticContract

診断が正常に作成されました。

ヘッダー

ETag: string

Other Status Codes

ErrorResponse

操作が失敗した理由を説明するエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

型: oauth2
フロー: implicit
Authorization URL (承認 URL): https://login.microsoftonline.com/common/oauth2/authorize

スコープ

名前 説明
user_impersonation ユーザー アカウントを偽装する

ApiManagementCreateDiagnostic

要求のサンプル

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights?api-version=2024-05-01

{
  "properties": {
    "alwaysLog": "allErrors",
    "loggerId": "/loggers/azuremonitor",
    "sampling": {
      "samplingType": "fixed",
      "percentage": 50
    },
    "frontend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    },
    "backend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    }
  }
}

応答のサンプル

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
  "type": "Microsoft.ApiManagement/service/diagnostics",
  "name": "applicationinsights",
  "properties": {
    "alwaysLog": "allErrors",
    "loggerId": "/loggers/azuremonitor",
    "sampling": {
      "samplingType": "fixed",
      "percentage": 50
    },
    "frontend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    },
    "backend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    }
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights",
  "type": "Microsoft.ApiManagement/service/diagnostics",
  "name": "applicationinsights",
  "properties": {
    "alwaysLog": "allErrors",
    "loggerId": "/loggers/applicationinsights",
    "sampling": {
      "samplingType": "fixed",
      "percentage": 50
    },
    "frontend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    },
    "backend": {
      "request": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      },
      "response": {
        "headers": [
          "Content-type"
        ],
        "body": {
          "bytes": 512
        }
      }
    }
  }
}

定義

名前 説明
AlwaysLog

適用しないメッセージ サンプリング設定の種類を指定します。

BodyDiagnosticSettings

本文ログの設定。

DataMasking
DataMaskingEntity
DataMaskingMode

データ マスク モード。

DiagnosticContract

診断の詳細。

ErrorAdditionalInfo

リソース管理エラーの追加情報。

ErrorDetail

エラーの詳細。

ErrorResponse

エラー応答

HttpCorrelationProtocol

Application Insights 診断に使用する関連付けプロトコルを設定します。

HttpMessageDiagnostic

Http メッセージ診断設定。

OperationNameFormat

Application Insights テレメトリの操作名の形式。 既定値は Name です。

PipelineDiagnosticSettings

ゲートウェイへの受信/送信 HTTP メッセージの診断設定。

SamplingSettings

診断のサンプリング設定。

SamplingType

サンプリングの種類。

Verbosity

トレース ポリシーによって出力されるトレースに適用される詳細レベル。

AlwaysLog

適用しないメッセージ サンプリング設定の種類を指定します。

説明
allErrors

サンプリング設定に関係なく、常にすべての誤った要求をログに記録します。

BodyDiagnosticSettings

本文ログの設定。

名前 説明
bytes

integer (int32)

maximum: 8192

ログに記録する要求本文のバイト数。

DataMasking

名前 説明
headers

DataMaskingEntity[]

ヘッダーのマスク設定

queryParams

DataMaskingEntity[]

URL クエリ パラメーターのマスク設定

DataMaskingEntity

名前 説明
mode

DataMaskingMode

データ マスク モード。

value

string

マスクするエンティティの名前 (ヘッダーやクエリ パラメーターの名前など)。

DataMaskingMode

データ マスク モード。

説明
Hide

エンティティの存在を非表示にします。

Mask

エンティティの値をマスクします。

DiagnosticContract

診断の詳細。

名前 説明
id

string

リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

リソースの名前

properties.alwaysLog

AlwaysLog

適用しないメッセージ サンプリング設定の種類を指定します。

properties.backend

PipelineDiagnosticSettings

バックエンドへの受信/送信 HTTP メッセージの診断設定

properties.frontend

PipelineDiagnosticSettings

ゲートウェイへの受信/送信 HTTP メッセージの診断設定。

properties.httpCorrelationProtocol

HttpCorrelationProtocol

Application Insights 診断に使用する関連付けプロトコルを設定します。

properties.logClientIp

boolean

ClientIP をログに記録します。 既定値は false です。

properties.loggerId

string

ターゲット ロガーのリソース ID。

properties.metrics

boolean

出力メトリック ポリシーを使用してカスタム メトリックを出力します。 Application Insights 診断設定にのみ適用されます。

properties.operationNameFormat

OperationNameFormat

Application Insights テレメトリの操作名の形式。 既定値は Name です。

properties.sampling

SamplingSettings

診断のサンプリング設定。

properties.verbosity

Verbosity

トレース ポリシーによって出力されるトレースに適用される詳細レベル。

type

string

リソースの種類。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"

ErrorAdditionalInfo

リソース管理エラーの追加情報。

名前 説明
info

object

追加情報。

type

string

追加情報の種類。

ErrorDetail

エラーの詳細。

名前 説明
additionalInfo

ErrorAdditionalInfo[]

エラーの追加情報。

code

string

エラー コード。

details

ErrorDetail[]

エラーの詳細。

message

string

エラー メッセージ。

target

string

エラーターゲット。

ErrorResponse

エラー応答

名前 説明
error

ErrorDetail

エラー オブジェクト。

HttpCorrelationProtocol

Application Insights 診断に使用する関連付けプロトコルを設定します。

説明
Legacy

要求の関連付けデータ Request-Id ヘッダーと Request-Context ヘッダーを挿入します。 https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.mdを参照してください。

None

関連付けヘッダーの読み取りと挿入は行わないでください。

W3C

トレース コンテキスト ヘッダーを挿入します。 https://w3c.github.io/trace-contextを参照してください。

HttpMessageDiagnostic

Http メッセージ診断設定。

名前 説明
body

BodyDiagnosticSettings

本文ログの設定。

dataMasking

DataMasking

データ マスクの設定。

headers

string[]

ログに記録する HTTP ヘッダーの配列。

OperationNameFormat

Application Insights テレメトリの操作名の形式。 既定値は Name です。

説明
Name

API_NAME;rev=API_REVISION - OPERATION_NAME

Url

HTTP_VERB URL

PipelineDiagnosticSettings

ゲートウェイへの受信/送信 HTTP メッセージの診断設定。

名前 説明
request

HttpMessageDiagnostic

要求の診断設定。

response

HttpMessageDiagnostic

応答の診断設定。

SamplingSettings

診断のサンプリング設定。

名前 説明
percentage

number (double)

minimum: 0
maximum: 100

固定レート サンプリングのサンプリングレート。

samplingType

SamplingType

サンプリングの種類。

SamplingType

サンプリングの種類。

説明
fixed

固定レート サンプリング。

Verbosity

トレース ポリシーによって出力されるトレースに適用される詳細レベル。

説明
error

'severity' が 'error' に設定されているトレースのみが、この診断インスタンスにアタッチされたロガーに送信されます。

information

'severity' が 'information' に設定され、'error' が設定されたトレースは、この診断インスタンスにアタッチされたロガーに送信されます。

verbose

トレース ポリシーによって出力されるすべてのトレースは、この診断インスタンスにアタッチされたロガーに送信されます。