

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Lex V2 でのオペレーションメトリクスのモニタリング
<a name="monitoring-operational-metrics"></a>

Amazon CloudWatch と AWS CloudTrail は、Amazon Lex V2 と統合してボットとのユーザーインタラクションをモニタリングするのに役立つ 2 つの AWS サービスです。これらのサービスを使用して、アクションを記録し、ほぼリアルタイムのデータを送信し、条件が満たされた場合の通知と自動アクションの設定を行います。

**Topics**
+ [Amazon CloudWatch によるオペレーションメトリクスの測定](monitoring-cloudwatch.md)
+ [for Lex V2 AWS CloudTrail でのイベントの表示](logging-using-cloudtrail.md)

# Amazon CloudWatch によるオペレーションメトリクスの測定
<a name="monitoring-cloudwatch"></a>

Amazon CloudWatch を使用して Amazon Lex V2 をモニタリングすることで、raw データを収集し、ほぼリアルタイムで読み取り可能なメトリクスに加工することができます。これらの統計は 15 か月間保持されるため、履歴情報にアクセスし、ウェブアプリケーションまたはサービスの動作をより的確に把握できます。また、特定のしきい値を監視するアラームを設定し、これらのしきい値に達したときに通知を送信したりアクションを実行したりできます。詳細については、[Amazon CloudWatch ユーザーガイド](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/) を参照してください。

Amazon Lex V2 サービスは、`AWS/Lex` 名前空間の以下のメトリクスをレポートします。


| メトリクス | 説明 | 
| --- | --- | 
|  `AssistedSlotResolutionModelAccessDeniedErrorCount`  |  Amazon Lex V2 が Amazon Bedrock へのアクセスを拒否された回数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) `RecognizeText` の有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `AssistedSlotResolutionModelInvocationCount`  |  Amazon Bedrock が呼び出された回数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) `RecognizeText` の有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `AssistedSlotResolutionModelSystemErrorCount`  |  Amazon Bedrock を呼び出したときに 5xx が発生した回数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) `RecognizeText` の有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `AssistedSlotResolutionModelThrottlingErrorCount`  |  Amazon Lex が Amazon Bedrock によってスロットリングされた回数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) `RecognizeText` の有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `AssistedSlotResolutionResolvedSlotCount`  |  Amazon Bedrock がスロット値を返した回数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) `RecognizeText` の有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `KendraIndexAccessError`  |  Amazon Lex V2 がお客様の Amazon Kendra インデックスにアクセスできなかった回数。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `KendraLatency`  |  `AMAZON.KendraSearchIntent` からのリクエストに Amazon Kendra が応答する所要時間。 有効なディメンション:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: ミリ秒  | 
|  `KendraSuccess`  |  Amazon Lex V2 がお客様の Amazon Kendra インデックスにアクセスできなかった回数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `KendraSystemErrors`  |  Amazon Lex V2 が Amazon Kendra インデックスをクエリできなかった回数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `KendraThrottledEvents`  |  Amazon Kendra が `AMAZON.KendraSearchIntent` からの リクエストをスロットルした回数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeConcurrency`  |  指定期間中の同時接続の数。`RuntimeConcurrency` は `StatisticSet` として報告されます。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeInvalidLambdaResponses`  |  指定された期間の無効な AWS Lambda レスポンスの数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeLambdaErrors`  |  指定期間中の Lambda ランタイムエラーの数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimePollyErrors`  |  指定期間中の無効な Amazon Polly レスポンスの数。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeRequestCount`  |  指定期間中のランタイムリクエストの数。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
| `RuntimeRequestLength` | Amazon Lex V2 ボットとの会話の合計の長さ。[StartConversation](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_runtime_StartConversation.html) オペレーションにのみ適用されます。 有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: ミリ秒 | 
|  `RuntimeSucessfulRequestLatency`  このメトリクスは `RuntimeSucessfulRequestLatency` で、`RuntimeSuccessfulRequestLatency` ではありません。   |  リクエストが成功してから、レスポンスが返されるまでのレイテンシー。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: ミリ秒  | 
|  `RuntimeSystemErrors`  |  指定期間中のシステムエラーの数。システムエラーのレスポンスコード範囲は 500〜599 です。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeThrottledEvents`  |  スロットルされたイベントの数。Amazon Lex V2 は、1 秒あたりに受け取るトランザクションの数がアカウントに設定された制限数を超えると、リクエストをスロットルします。アカウントに設定された制限を頻繁に超える場合は、制限の引き上げをリクエストできます。引き上げをリクエストするには、「[AWS のサービス制限](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)」を参照してください。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 
|  `RuntimeUserErrors`  |  指定期間中のユーザーエラーの数。ユーザーエラーのレスポンスコード範囲は 400〜499 です。 `RecognizeUtterance` または `StartConversation` オペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 他のオペレーションの有効なディメンション: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/lexv2/latest/dg/monitoring-cloudwatch.html) 単位: 数  | 

Amazon Lex V2 メトリクスでサポートされるディメンションは以下のとおりです。


|  ディメンション  |  説明  | 
| --- | --- | 
|  Operation  |  Amazon Lex V2 オペレーションの名前 — `RecognizeText`、`RecognizeUtterance`、`StartConversation`、`GetSession`、`PutSession`、`DeleteSession` — エントリを生成しました。  | 
|  BotId  |  ボットの一意の英数字識別子。  | 
|  BotAliasId  |  ボットエイリアスの一意の英数字識別子。  | 
|  BotVersion  |  ボットの数値バージョン。  | 
|  InputMode  |  ボットへの入力のタイプ (スピーチ、テキスト、または DTMF)。  | 
|  LocaleId  |  en-US や fr-CA など、ボットのロケールの識別子。  | 
|  Model  |  Amazon Bedrock の大規模言語モデルのモデル ID を示します。  | 
|  ModelType  |  Amazon Bedrock から呼び出す大規模言語モデルのタイプを示します。  | 

# for Lex V2 AWS CloudTrail でのイベントの表示
<a name="logging-using-cloudtrail"></a>

Amazon Lex V2 は AWS CloudTrail、Amazon Lex V2 のユーザー、ロール、または AWS のサービスによって実行されたアクションを記録するサービスである Amazon Lex と統合されています。CloudTrail は、Amazon Lex V2 の API コールをイベントとしてキャプチャします。キャプチャされた呼び出しには、Amazon Lex V2 コンソールからの呼び出しと、Amazon Lex V2 API オペレーションへのコード呼び出しが含まれます。証跡を作成する場合は、Amazon Lex V2 のイベントなど、Amazon S3 バケットへの CloudTrail イベントの継続的な配信を有効にすることができます。証跡を設定しない場合でも、CloudTrail コンソールの **[イベント履歴]** で最新のイベントを表示できます。CloudTrail で収集された情報を使用して、Amazon Lex V2 に対するリクエスト、リクエスト元の IP アドレス、リクエスト者、リクエスト日時などの詳細を確認できます。

CloudTrail の詳細については、「[AWS CloudTrail ユーザーガイド](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)」を参照してください。

## CloudTrail のAmazon Lex V2 情報
<a name="lex-info-in-cloudtrail"></a>

CloudTrail は、アカウント作成時に AWS アカウントで有効になります。Amazon Lex V2 でアクティビティが発生すると、そのアクティビティはイベント**履歴**の他の AWS サービスイベントとともに CloudTrail イベントに記録されます。最近のイベントは、AWS アカウントで表示、検索、ダウンロードできます。詳細については、「[CloudTrail イベント履歴でのイベントの表示](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html)」を参照してください。

Amazon Lex V2 のイベントなど、AWS アカウントのイベントの継続的な記録については、証跡を作成します。追跡により、CloudTrail はログファイルを Simple Storage Service (Amazon S3) バケットに配信できます。**デフォルトでは、コンソールで作成した証跡がすべての AWS リージョンに適用されます。証跡では、AWS パーティションのすべてのリージョンからのイベントがログに記録され、指定した Amazon S3 バケットにログファイルが配信されます。さらに、その他の AWS サービスを設定して、CloudTrail ログで収集されたデータをより詳細に分析し、それに基づく対応を行うことができます。詳細については、以下を参照してください。
+ [追跡を作成するための概要](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
+ [CloudTrail がサポートされているサービスと統合](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html)
+ 「[CloudTrail の Amazon SNS 通知の設定](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/configure-sns-notifications-for-cloudtrail.html)」
+ [複数のリージョンから CloudTrail ログファイルを受け取る](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html)および[複数のアカウントから CloudTrail ログファイルを受け取る](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)

Amazon Lex V2 は、「[モデル構築 API V2](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_Operations_Amazon_Lex_Model_Building_V2.html)」に記載されているすべてのアクションのログ記録をサポートしています。

各イベントまたはログエントリには、誰がリクエストを生成したかという情報が含まれます。アイデンティティ情報は、以下を判別するのに役立ちます。
+ リクエストがルートまたは AWS Identity and Access Management IAM ユーザー認証情報を使用して行われたかどうか。
+ リクエストが、ロールとフェデレーティッドユーザーのどちらの一時的なセキュリティ認証情報を使用して送信されたか。
+ リクエストが AWS の別のサービスによって生成されたかどうか。

詳細については、「[CloudTrail userIdentity エレメント](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html)」を参照してください。

## Amazon Lex V2 ログファイルエントリの理解
<a name="understanding-service-name-entries"></a>

「トレイル」は、指定した Amazon S3 バケットにイベントをログファイルとして配信するように設定できます。CloudTrail のログファイルは、単一か複数のログエントリを含みます。イベントは、任意の出典からの単一のリクエストを表し、リクエストされたアクション、アクションの日時、リクエストパラメータなどに関する情報が含まれます。CloudTrail ログファイルは、パブリック API 呼び出しの順序付けられたスタックトレースではないため、特定の順序では表示されません。

次の例は、[CreateBotAlias](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_CreateBotAlias.html) アクションを示す CloudTrail ログエントリです。

```
{
    "eventVersion": "1.05",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "ID of caller:temporary credentials",
        "arn": "arn:aws:sts::111122223333:assumed-role/role name/role ARN",
        "accountId": "111122223333",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "ID of caller",
                "arn": "arn:aws:iam::111122223333:role/role name",
                "accountId": "111122223333",
                "userName": "role name"
            },
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": "creation date"
            }
        }
    },
    "eventTime": "event timestamp",
    "eventSource": "lex.amazonaws.com",
    "eventName": "CreateBotAlias",
    "awsRegion": "Region",
    "sourceIPAddress": "192.0.2.0",
    "userAgent": "user agent",
    "requestParameters": {
        "botAliasLocaleSettingsMap": {
            "en_US": {
                "enabled": true
            }
        },
        "botId": "bot ID",
        "botAliasName": "bot aliase name",
        "botVersion": "1"
    },
    "responseElements": {
        "botAliasLocaleSettingsMap": {
            "en_US": {
                "enabled": true
            }
        },
        "botAliasId": "bot alias ID",
        "botAliasName": "bot alias name",
        "botId": "bot ID",
        "botVersion": "1",
        "creationDateTime": creation timestamp
    },
    "requestID": "unique request ID",
    "eventID": "unique event ID",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "recipientAccountId": "111122223333"
}
```