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 パラメーター
名前 | / | 必須 | 型 | 説明 |
---|---|---|---|---|
diagnostic
|
path | True |
string minLength: 1maxLength: 80 pattern: ^[^*#&+:<>?]+$ |
診断識別子。 現在の API Management サービス インスタンスで一意である必要があります。 |
resource
|
path | True |
string minLength: 1maxLength: 90 |
リソース グループの名前。 名前では大文字と小文字が区別されません。 |
service
|
path | True |
string minLength: 1maxLength: 50 pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$ |
API Management サービスの名前。 |
subscription
|
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 |
適用しないメッセージ サンプリング設定の種類を指定します。 |
||
properties.backend |
バックエンドへの受信/送信 HTTP メッセージの診断設定 |
||
properties.frontend |
ゲートウェイへの受信/送信 HTTP メッセージの診断設定。 |
||
properties.httpCorrelationProtocol |
Application Insights 診断に使用する関連付けプロトコルを設定します。 |
||
properties.logClientIp |
boolean |
ClientIP をログに記録します。 既定値は false です。 |
|
properties.metrics |
boolean |
出力メトリック ポリシーを使用してカスタム メトリックを出力します。 Application Insights 診断設定にのみ適用されます。 |
|
properties.operationNameFormat |
Application Insights テレメトリの操作名の形式。 既定値は Name です。 |
||
properties.sampling |
診断のサンプリング設定。 |
||
properties.verbosity |
トレース ポリシーによって出力されるトレースに適用される詳細レベル。 |
応答
名前 | 型 | 説明 |
---|---|---|
200 OK |
診断が正常に更新されました ヘッダー ETag: string |
|
201 Created |
診断が正常に作成されました。 ヘッダー ETag: string |
|
Other Status Codes |
操作が失敗した理由を説明するエラー応答。 |
セキュリティ
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
}
}
}
}
}
定義
名前 | 説明 |
---|---|
Always |
適用しないメッセージ サンプリング設定の種類を指定します。 |
Body |
本文ログの設定。 |
Data |
|
Data |
|
Data |
データ マスク モード。 |
Diagnostic |
診断の詳細。 |
Error |
リソース管理エラーの追加情報。 |
Error |
エラーの詳細。 |
Error |
エラー応答 |
Http |
Application Insights 診断に使用する関連付けプロトコルを設定します。 |
Http |
Http メッセージ診断設定。 |
Operation |
Application Insights テレメトリの操作名の形式。 既定値は Name です。 |
Pipeline |
ゲートウェイへの受信/送信 HTTP メッセージの診断設定。 |
Sampling |
診断のサンプリング設定。 |
Sampling |
サンプリングの種類。 |
Verbosity |
トレース ポリシーによって出力されるトレースに適用される詳細レベル。 |
AlwaysLog
適用しないメッセージ サンプリング設定の種類を指定します。
値 | 説明 |
---|---|
allErrors |
サンプリング設定に関係なく、常にすべての誤った要求をログに記録します。 |
BodyDiagnosticSettings
本文ログの設定。
名前 | 型 | 説明 |
---|---|---|
bytes |
integer (int32) maximum: 8192 |
ログに記録する要求本文のバイト数。 |
DataMasking
名前 | 型 | 説明 |
---|---|---|
headers |
ヘッダーのマスク設定 |
|
queryParams |
URL クエリ パラメーターのマスク設定 |
DataMaskingEntity
名前 | 型 | 説明 |
---|---|---|
mode |
データ マスク モード。 |
|
value |
string |
マスクするエンティティの名前 (ヘッダーやクエリ パラメーターの名前など)。 |
DataMaskingMode
データ マスク モード。
値 | 説明 |
---|---|
Hide |
エンティティの存在を非表示にします。 |
Mask |
エンティティの値をマスクします。 |
DiagnosticContract
診断の詳細。
名前 | 型 | 説明 |
---|---|---|
id |
string |
リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
リソースの名前 |
properties.alwaysLog |
適用しないメッセージ サンプリング設定の種類を指定します。 |
|
properties.backend |
バックエンドへの受信/送信 HTTP メッセージの診断設定 |
|
properties.frontend |
ゲートウェイへの受信/送信 HTTP メッセージの診断設定。 |
|
properties.httpCorrelationProtocol |
Application Insights 診断に使用する関連付けプロトコルを設定します。 |
|
properties.logClientIp |
boolean |
ClientIP をログに記録します。 既定値は false です。 |
properties.loggerId |
string |
ターゲット ロガーのリソース ID。 |
properties.metrics |
boolean |
出力メトリック ポリシーを使用してカスタム メトリックを出力します。 Application Insights 診断設定にのみ適用されます。 |
properties.operationNameFormat |
Application Insights テレメトリの操作名の形式。 既定値は Name です。 |
|
properties.sampling |
診断のサンプリング設定。 |
|
properties.verbosity |
トレース ポリシーによって出力されるトレースに適用される詳細レベル。 |
|
type |
string |
リソースの種類。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts" |
ErrorAdditionalInfo
リソース管理エラーの追加情報。
名前 | 型 | 説明 |
---|---|---|
info |
object |
追加情報。 |
type |
string |
追加情報の種類。 |
ErrorDetail
エラーの詳細。
名前 | 型 | 説明 |
---|---|---|
additionalInfo |
エラーの追加情報。 |
|
code |
string |
エラー コード。 |
details |
エラーの詳細。 |
|
message |
string |
エラー メッセージ。 |
target |
string |
エラーターゲット。 |
ErrorResponse
エラー応答
名前 | 型 | 説明 |
---|---|---|
error |
エラー オブジェクト。 |
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 |
本文ログの設定。 |
|
dataMasking |
データ マスクの設定。 |
|
headers |
string[] |
ログに記録する HTTP ヘッダーの配列。 |
OperationNameFormat
Application Insights テレメトリの操作名の形式。 既定値は Name です。
値 | 説明 |
---|---|
Name |
API_NAME;rev=API_REVISION - OPERATION_NAME |
Url |
HTTP_VERB URL |
PipelineDiagnosticSettings
ゲートウェイへの受信/送信 HTTP メッセージの診断設定。
名前 | 型 | 説明 |
---|---|---|
request |
要求の診断設定。 |
|
response |
応答の診断設定。 |
SamplingSettings
診断のサンプリング設定。
名前 | 型 | 説明 |
---|---|---|
percentage |
number (double) minimum: 0maximum: 100 |
固定レート サンプリングのサンプリングレート。 |
samplingType |
サンプリングの種類。 |
SamplingType
サンプリングの種類。
値 | 説明 |
---|---|
fixed |
固定レート サンプリング。 |
Verbosity
トレース ポリシーによって出力されるトレースに適用される詳細レベル。
値 | 説明 |
---|---|
error |
'severity' が 'error' に設定されているトレースのみが、この診断インスタンスにアタッチされたロガーに送信されます。 |
information |
'severity' が 'information' に設定され、'error' が設定されたトレースは、この診断インスタンスにアタッチされたロガーに送信されます。 |
verbose |
トレース ポリシーによって出力されるすべてのトレースは、この診断インスタンスにアタッチされたロガーに送信されます。 |