Create a custom rule

  1. In the AWS Management Console on the Services menu, click APIGateway.
  2. Select the API Gateway called PetAdoptionStatusUpdater by clicking the name.
  3. In the navigation menu on the left, click Stages, then select Prod.
  4. Click on the Logs/Tracing tab.
  5. Check the checkbox labeled Log full requests/responses data. This will send detailed log data to CloudWatch which we will use in this exercise.

The above is a temporary action to get detailed log data to learn about CloudWatch Contributor Insights.

Contributor Rule

  1. Navigate to CloudWatch Contributor Insights in the AWS Console.
  2. On the Contributor Insights home page, click Create rule. You will see a screen like the one below.

You can see that there are numerous sample rules readily available for us to use. However, we will create our own rule.

Contributor Create Rule

  1. Select Custom rule.
  2. Enter PetTypes in the name field.
  3. Select API-Gateway-Execution-Logs from the drop down for the Log group field.
  4. Leave the log format as JSON.
  5. Enter pettype in the first textbox under Contribution. Leave COUNT as selected for Aggregate on.
  6. Click create.

You have just created a Contributor Insights rule, which will automatically create a Top ‘N’ report based on the rule. If the traffic generator app is running, you should be able to see a graph like the one below in a few minutes time. Contributor Create Rule2

If you leave it long enough, you will see a report similar to the one below:

Contributor Long term

Turn off detailed logging

  1. In the AWS Management Console on the Services menu, click APIGateway.
  2. Select the API Gateway called PetAdoptionStatusUpdater by clicking the name.
  3. In the navigation menu on the left, click Stages, then select Prod.
  4. Click on the Logs/Tracing tab.
  5. Uncheck the checkbox labeled Log full requests/responses data.

Contributor Insights in Logs Insights

You can also see your Contributor Insights Rules from within CloudWatch Logs console as shown below.

Contributor Insights Logs Insights

Contributor Insights in DynamoDB

You can also see your Contributor Insights Rules and Graphs from within the DynamoDB console as shown below.

Contributor Insights DynamoDB

This concludes the Contributor Insights module.