Why can't I view conversation logs for Amazon Lex in CloudWatch?

3 minute read
0

I am unable to view the conversation logs for Amazon Lex in Amazon CloudWatch.

Short description

There are several reasons why you might not see your Amazon Lex conversation logs in CloudWatch. For example, you might not have the right permissions configured to allow Amazon Lex use CloudWatch logs. Or, you might have enabled COPPA on your bot which doesn't allow you to use the conversation logs feature.

Use the troubleshooting steps in this article to find the root cause of this issue.

Resolution

Add an IAM role and policy to Amazon Lex

Check if you have granted the correct permissions to allow your Amazon Lex bot to log to CloudWatch. To log conversation logs, Amazon Lex needs to use CloudWatch logs and access Amazon Simple Storage Service (Amazon S3) buckets to store conversation logs. Follow these steps to add the required AWS Identity and Access Management (IAM) roles and policies using the Amazon Lex console.

1.    Open the Amazon Lex console, and choose the bot that you want to edit.

2.    Choose Settings, and then choose Conversation logs.

3.    Choose the settings icon, and then choose IAM role.

4.    Add an IAM role with trust relationship similar to this:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "lex.amazonaws.com"   //For V2 "Service": "lexv2.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
  1. Attach an IAM policy to the role that allows logging of conversation text to CloudWatch logs:
{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "logs:CreateLogStream",
              "logs:PutLogEvents"
          ],
          "Resource": "arn:aws:logs:region:account-id:log-group:log-group-name:*"
      }
  ]
}

6.    Add an IAM policy to the role that allows audio logging to an S3 bucket:

{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "s3:PutObject"
          ],
          "Resource": "arn:aws:s3:::bucket-name/*"
      }
  ]
}

Review your COPPA settings

Check if COPPA is enabled for your bot. If you enabled COPPA, then you can't use the conversation logs feature for that bot.

Using Amazon Lex V1

To check this setting, check the general settings of your bot using the Amazon Lex console.

1.    Open the Amazon Lex console, and then choose Return to the V1 console.

2.    Choose the bot that you want to edit.

2.    Choose Settings, and then choose General.

3.    Choose COPPA.

Use Amazon Lex V2

1.    Open the Amazon Lex V2 console, and choose bot versions.

2.    Choose the version that you want to use, and then choose COPPA.

3.    If COPPA is enabled for a version you want to use, you can't disable it. Instead, go to Draft versions, and choose COPPA. You can now change COPPA to no, and publish a new version.

Further troubleshooting steps

1.    Check that the log group you're using is in the same Region as your Amazon Lex bot.

2.    Check that the bot alias that you're using and the alias that you specified logging for are the same. Conversation logs are configured according to bot alias, so it's important that they match.

3.    Check that you aren't using $LATEST alias or a test bot that Amazon Lex provides for testing. You can't log conversations for either of these.

4.    Check that you haven't enabled AI services opt out policies in your AWS organization. If you enable opt-out policies, then Amazon Lex doesn't log conversation logs.


Related information

Conversation logs

IAM policies for conversation logs

Monitoring with conversation logs

AWS OFFICIAL
AWS OFFICIALUpdated 10 months ago