Go to APIGateway console and select the API Gateway called PetAdoptionStatusUpdater
that was created as part of the CDK.
Go to Stages
, select Prod
and select the tab Logs/Tracing
. Under this, enable the checkbox called 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.
On the Contributor Insights home page, click on
Create rule
. You will see a screen like the one below.
As you can see that there are numerous sample rules readily available for us to use. However, we will create our own rule.
Select Custom rule
and click Create
In the next page, give the rule a name, select the Log group in which the API Gateway logs are collected. To find this, look for log groups starting with API-Gateway-Execution-Logs
in the drop down.
Leave log format as JSON
Enter pettype
in the first textbox under Contribution
Leave COUNT
as selected for Agggregate on
and click Create
to create the custom rule.
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.
If you leave it long enough, you will see a report similar to the one below
Now go to the APIGateway console and select Stages
, prod
and uncheck the Log full requests/responses data
checkbox under Logs/Tracing
tab.
You can also see your Contributor Insights Rules from within CloudWatch Logs console as shown below.
You can also see your Contributor Insights Rules and Graphs from within DynamoDB console as shown below.