---
title: "HTTPリクエストログの設定"
slug: "configure-http-request-logging"
abstract: "HTTPリクエストログングを設定して、xConnectへのHTTPリクエストと応答を追跡する方法。"
---
# HTTPリクエストログの設定

拡張されたxConnectログは、xConnectへのHTTPリクエストやレスポンスを追跡できます。これはデフォルトで無効化されています。

## HTTPリクエストログングを有効にする

HTTPリクエストログを有効にするには:

-   ファイル名を\\App\_Data\\Config\\Sitecore\\CoreServices\\sc.XConnect.RequestLogging.Web.Host.xmlに変えて\\App\_Data\\Config\\Sitecore\\CoreServices\\sc.XConnect.RequestLogging.Web.Host.xml.disabledを有効にしてください。

### HTTPリクエストログの出力例

ログ出力にはリクエスト(メソッド、URI、HTTPヘッダー、リクエスト内容)とレスポンス(URI、ステータスコード、HTTPヘッダー、コンテンツ)が含まれます。リクエストとレスポンスをIdフィールドでマッチさせることができます。

2021-06-03 \`14:28\`:35.167 +\`03:00\` Verbose Sending HTTP request Http trace
{
 "Id": 13621,
 "HttpMethod": {
 "Method": "POST"
 },
 "Uri": "https://xcp\_xconnect/odata/Contacts(44f965ad-28dd-4095-91b6-69e77e696daa)/Interactions",
 "HeadersInfo": 
 {
 "Key": "Host",
 "Value": 
 "xcp\_xconnect"
 
 },
 {
 "Key": "OData-Version",
 "Value": 
 "4.0"
 
 },
 {
 "Key": "Accept",
 "Value": 
 "application/json; odata.metadata.context=false"
 
 },
 {
 "Key": "Content-Type",
 "Value": 
 "application/json; charset=utf-8; odata.metadata.context=false"
 
 },
 {
 "Key": "Content-Length",
 "Value": 
 "643"
 
 }
 ,
 "Content": "{\\"ChannelId\\":\\"7886e1f5-b85c-484b-bfee-0cb3678dbf0a\\",\\"StartDateTime\\":\\"2021-06-03T11:\`49:14\`.5869922Z\\",\\"EndDateTime\\":\\"2021-06-03T11:\`49:44\`.5869922Z\\",\\"Duration\\":\\"PT30S\\",\\"Events\\":{\\"@odata.type\\":\\"#Sitecore.XConnect.Collection.Model.PageViewEvent\\",\\"CustomValues\\":,\\"DefinitionId\\":\\"9326cb1e-cec8-48f2-9a3e-91c7dbb2166c\\",\\"ItemId\\":\\"110d559f-dea5-42ea-9c1c-8a5df7e70ef9\\",\\"Id\\":\\"e61bcbad-e464-4e60-afce-0c7004fd20c0\\",\\"Text\\":\\"Parent Event: 9326cb1ecec848f29a3e91c7dbb2166c\\",\\"Timestamp\\":\\"2021-06-03T11:\`49:14\`.5869922Z\\",\\"Duration\\":\\"PT30S\\",\\"ItemLanguage\\":\\"ja-JP\\",\\"ItemVersion\\":1},\\"UserAgent\\":\\"abc4f918-b686-4e1e-9c2e-dfa4cbfd1a69\\",\\"Contact\\":{\\"@odata.id\\":\\"$2\\"}}"
}

2021-06-03 \`14:28\`:35.167 +\`03:00\` Verbose Received HTTP response Http trace
{
 "Id": 13621,
 "Uri": "https://xcp\_xconnect/odata/Contacts(44f965ad-28dd-4095-91b6-69e77e696daa)/Interactions",
 "StatusCode": 200,
 "Duration": "\`00:00\`:00.0002137",
 "HeadersInfo": 
 {
 "Key": "Content-Type",
 "Value": 
 "application/json"
 
 }
 ,
 "Content": null
}

## HTTPリクエストログのログ詳細を変更する

HTTPリクエストログのログ詳細を変更することは可能です。以下のいずれかの値を選択できます:

-   OnlyRequest(リクエストとレスポンスをヘッダーや内容なしでログに記録します)。
    
    2021-06-03 \`17:05\`:10.456 +\`03:00\` Verbose Sending HTTP request Http trace
    {
     "Id": 4,
     "HttpMethod": {
     "Method": "GET"
     },
     "Uri": "https://xcp\_xconnect:443/odata/Contacts?%24filter=Id+eq+4b1e26d2-7988-0000-0000-062609cf16cb&%24expand=Identifiers,MergeInfo,ConsentInformation",
     "HeadersInfo": null,
     "Content": null
    }
    
    2021-06-03 \`17:05\`:10.460 +\`03:00\` Verbose Received HTTP response Http trace
    {
     "Id": 4,
     "Uri": "https://xcp\_xconnect:443/odata/Contacts?%24filter=Id+eq+4b1e26d2-7988-0000-0000-062609cf16cb&%24expand=Identifiers,MergeInfo,ConsentInformation",
     "StatusCode": 200,
     "Duration": "\`00:00\`:00.0036468",
     "HeadersInfo": null,
     "Content": null
    }
    
-   RequestWithHeaders(リクエストおよびレスポンスヘッダーは内容情報なしでログに記録します)。
    
    2021-06-03 \`17:07\`:13.475 +\`03:00\` Verbose Sending HTTP request Http trace
    {
     "Id": 4,
     "HttpMethod": {
     "Method": "GET"
     },
     "Uri": "https://xcp\_xconnect:443/odata/Contacts?%24filter=Id+eq+8a167bdf-922c-0000-0000-062609e1e7c7&%24expand=Identifiers,MergeInfo,ConsentInformation",
     "HeadersInfo": 
     {
     "Key": "Accept",
     "Value": 
     "application/json; odata.metadata.context=false"
     
     },
     {
     "Key": "Host",
     "Value": 
     "xcp\_xconnect"
     
     },
     {
     "Key": "OData-Version",
     "Value": 
     "4.0"
     
     }
     ,
     "Content": null
    }
    
    2021-06-03 \`17:07\`:13.480 +\`03:00\` Verbose Received HTTP response Http trace
    {
     "Id": 4,
     "Uri": "https://xcp\_xconnect:443/odata/Contacts?%24filter=Id+eq+8a167bdf-922c-0000-0000-062609e1e7c7&%24expand=Identifiers,MergeInfo,ConsentInformation",
     "StatusCode": 200,
     "Duration": "\`00:00\`:00.0043318",
     "HeadersInfo": 
     {
     "Key": "Content-Type",
     "Value": 
     "application/json"
     
     }
     ,
     "Content": null
    }
    
-   Full(リクエストとレスポンスのすべての情報をログに記録します)。
    

HTTPリクエストログの詳細はデフォルトでFullに設定されています。

ログの詳細を変更するには:

-   設定ファイルを開いて\\App\_Data\\Config\\Sitecore\\CoreServices\\sc.XConnect.RequestLogging.Web.Host.xmlSettings/Sitecore/XConnect/Services/HttpRequestLoggingConfiguration/Options/HttpRequestAndResponseLogLevelノードの値を変更してください。
    
    <Options>
     <HttpRequestAndResponseLogLevel>Full</HttpRequestAndResponseLogLevel>
    </Options>