檢視亞馬遜日誌中的文字 CloudWatch 日誌 - Amazon Lex V1

如果您使用的是 Amazon Lex V2,請參閱 Amazon Lex V2 指南

 

如果您使用的是 Amazon Lex V1,我們建議您將機器人升級到 Amazon Lex V2。我們不再向 V1 添加新功能,強烈建議所有新的機器人使用 V2。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

檢視亞馬遜日誌中的文字 CloudWatch 日誌

Amazon Lex 會在亞馬遜日誌中儲存您對話的文字 CloudWatch 日誌。若要檢視記錄,您可以使用記 CloudWatch 錄主控台或 API。如需詳細資訊,請參閱 Amazon Logs 使用者指南中的使用篩選器模式和CloudWatch 日誌見解查詢語法搜尋 CloudWatch 日誌資

若要使用 Amazon Lex 主控台檢視日誌
  1. 打開 Amazon Lex 控制台 https://console.aws.amazon.com/lex

  2. 從清單中選擇一個機器人。

  3. 選擇 Settings (設定) 標籤,然後從左側功能表中選擇 Conversation logs (對話日誌)

  4. 選擇 [文字記錄] 下方的連結,以在 CloudWatch 主控台中檢視別名的記錄檔。

您也可以使用主 CloudWatch 控台或 API 來檢視您的記錄項目。若要尋找日誌項目,請導覽至您針對別名設定的日誌群組。您可以在 Amazon Lex 主控台或使用GetBotAlias操作找到日誌的日誌串流前置詞。

使用者表達用語的日誌項目位於多個日誌串流中。對話中的表達用語在其中一個日誌串流中具有指定前綴的項目。日誌串流中的項目包含下列資訊。

{ "messageVersion": "1.0", "botName": "bot name", "botAlias": "bot alias", "botVersion": "bot version", "inputTranscript": "text used to process the request", "botResponse": "response from the bot", "intent": "matched intent", "nluIntentConfidence": "number", "slots": { "slot name": "slot value", "slot name": null, "slot name": "slot value" ... }, "alternativeIntents": [ { "name": "intent name", "nluIntentConfidence": "number", "slots": { "slot name": slot value, "slot name": null, "slot name": slot value ... } }, { "name": "intent name", "nluIntentConfidence": number, "slots": {} } ], "developerOverride": "true" | "false", "missedUtterance": true | false, "inputDialogMode": "Text" | "Speech", "requestId": "request ID", "s3PathForAudio": "S3 path to audio file", "userId": "user ID", "sessionId": "session ID", "sentimentResponse": { "sentimentScore": "{Positive: number, Negative: number, Neutral: number, Mixed: number}", "sentimentLabel": "Positive" | "Negative" | "Neutral" | "Mixed" }, "slotToElicit": "slot name", "dialogState": "ElicitIntent" | "ConfirmIntent" | "ElicitSlot" | "Fulfilled" | "ReadyForFulfillment" | "Failed", "responseCard": { "genericAttachments": [ ... ], "contentType": "application/vnd.amazonaws.card.generic", "version": 1 }, "locale": "locale", "timestamp": "ISO 8601 UTC timestamp", "kendraResponse": { "totalNumberOfResults": number, "resultItems": [ { "id": "query ID", "type": "DOCUMENT" | "QUESTION_ANSWER" | "ANSWER", "additionalAttributes": [ { ... } ], "documentId": "document ID", "documentTitle": { "text": "title", "highlights": null }, "documentExcerpt": { "text": "text", "highlights": [ { "beginOffset": number, "endOffset": number, "topAnswer": true | false } ] }, "documentURI": "URI", "documentAttributes": [] } ], "facetResults": [], "sdkResponseMetadata": { "requestId": "request ID" }, "sdkHttpMetadata": { "httpHeaders": { "Content-Length": "number", "Content-Type": "application/x-amz-json-1.1", "Date": "date and time", "x-amzn-RequestId": "request ID" }, "httpStatusCode": 200 }, "queryId": "query ID" }, "sessionAttributes": { "attribute name": "attribute value" ... }, "requestAttributes": { "attribute name": "attribute value" ... } }

日誌項目的內容取決於交易的結果以及機器人和請求的組態。

  • missedUtterance 欄位是 true,則 intentslotsslotToElicit 不會顯示在輸入中。

  • 如果音訊日誌已停用或 inputDialogMode 欄位是 Text,則 s3PathForAudio 欄位不會出現。

  • 只有在您為機器人定義回應卡片時,才會顯示 responseCard 欄位。

  • 只有在請求中指定了請求屬性時,才會顯示 requestAttributes 對映。

  • 只有當提出搜索 Amazon Kendra 索引的請求時,該kendraResponseAMAZON.KendraSearchIntent字段才存在。

  • 當在機器人的 Lambda 函數中指定替代意圖時,此developerOverride欄位為真。

  • 只有在請求中指定了工作階段屬性時,才會顯示 sessionAttributes 映射。

  • 只有在您設定機器人傳回情緒值時,才會顯示 sentimentResponse 映射。

注意

即使 messageVersion 中沒有對應的變更,輸入格式也可能變更。如果出現新欄位,您的程式碼不應擲出錯誤。

您必須設定角色和政策,才能讓 Amazon Lex 寫入 CloudWatch 日誌。如需詳細資訊,請參閱 交談記錄的 IAM 政策