If you are using Amazon Lex V2, refer to the Amazon Lex V2 guide instead.
If you are using Amazon Lex V1, we recommend upgrading your bots to Amazon Lex V2. We are no longer adding new features to V1 and strongly recommend using V2 for all new bots.
Viewing Text Logs in Amazon CloudWatch Logs
Amazon Lex stores text logs for your conversations in Amazon CloudWatch Logs. To view the logs, you can use the CloudWatch Logs console or API. For more information, see Search Log Data Using Filter Patterns and CloudWatch Logs Insights Query Syntax in the Amazon CloudWatch Logs User Guide.
To view logs using the Amazon Lex console
-
Open the Amazon Lex console https://console.aws.amazon.com/lex
. -
From the list, choose a bot.
-
Choose the Settings tab, then from the left menu choose Conversation logs.
-
Choose the link under Text logs to view the logs for the alias in the CloudWatch console.
You can also use the CloudWatch console or API to view your log entries. To find the log entries, navigate to the log group that you configured for the alias. You find the log stream prefix for your logs in the Amazon Lex console or by using the GetBotAlias operation.
Log entries for a user utterance is in multiple log streams. An utterance in the conversation has an entry in one of the log streams with the specified prefix. An entry in the log stream contains the following information.
{
"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
"
...
}
}
The contents of the log entry depends on the result of a transaction and the configuration of the bot and request.
-
The
intent
,slots
, andslotToElicit
fields don't appear in an entry if themissedUtterance
field istrue
. -
The
s3PathForAudio
field doesn't appear if audio logs are disabled or if theinputDialogMode
field isText
. -
The
responseCard
field only appears when you have defined a response card for the bot. -
The
requestAttributes
map only appears if you have specified request attributes in the request. -
The
kendraResponse
field is only present when theAMAZON.KendraSearchIntent
makes a request to search an Amazon Kendra index. -
The
developerOverride
field is true when an alternative intent was specified in the bot's Lambda function. -
The
sessionAttributes
map only appears if you have specified session attributes in the request. -
The
sentimentResponse
map only appears if you configure the bot to return sentiment values.
Note
The input format may change without a corresponding change in the
messageVersion
. Your code should not throw an error if new
fields are present.
You must have a role and policy set to enable Amazon Lex to write to CloudWatch Logs. For more information see IAM Policies for Conversation Logs.