Logging Performance Insights calls using Amazon CloudTrail - Amazon Relational Database Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Logging Performance Insights calls using Amazon CloudTrail

Performance Insights runs with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon service in Performance Insights. CloudTrail captures all API calls for Performance Insights as events. This capture includes calls from the Amazon RDS console and from code calls to the Performance Insights API operations.

If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Performance Insights. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the data collected by CloudTrail, you can determine certain information. This information includes the request that was made to Performance Insights, the IP address the request was made from, who made the request, and when it was made. It also includes additional details.

To learn more about CloudTrail, see the Amazon CloudTrail User Guide.

Working with Performance Insights information in CloudTrail

CloudTrail is enabled on your Amazon account when you create the account. When activity occurs in Performance Insights, that activity is recorded in a CloudTrail event along with other Amazon service events in the CloudTrail console in Event history. You can view, search, and download recent events in your Amazon account. For more information, see Viewing Events with CloudTrail Event History in Amazon CloudTrail User Guide.

For an ongoing record of events in your Amazon account, including events for Performance Insights, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all Amazon Regions. The trail logs events from all Amazon Regions in the Amazon partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other Amazon services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following topics in Amazon CloudTrail User Guide:

All Performance Insights operations are logged by CloudTrail and are documented in the Performance Insights API Reference. For example, calls to the DescribeDimensionKeys and GetResourceMetrics operations generate entries in the CloudTrail log files.

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or IAM user credentials.

  • Whether the request was made with temporary security credentials for a role or federated user.

  • Whether the request was made by another Amazon service.

For more information, see the CloudTrail userIdentity Element.

Performance Insights log file entries

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source. Each event includes information about the requested operation, the date and time of the operation, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the GetResourceMetrics operation.

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws-cn:iam::123456789012:user/johndoe", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "userName": "johndoe" }, "eventTime": "2019-12-18T19:28:46Z", "eventSource": "pi.amazonaws.com", "eventName": "GetResourceMetrics", "awsRegion": "us-east-1", "sourceIPAddress": "72.21.198.67", "userAgent": "aws-cli/1.16.240 Python/3.7.4 Darwin/18.7.0 botocore/1.12.230", "requestParameters": { "identifier": "db-YTDU5J5V66X7CXSCVDFD2V3SZM", "metricQueries": [ { "metric": "os.cpuUtilization.user.avg" }, { "metric": "os.cpuUtilization.idle.avg" } ], "startTime": "Dec 18, 2019 5:28:46 PM", "periodInSeconds": 60, "endTime": "Dec 18, 2019 7:28:46 PM", "serviceType": "RDS" }, "responseElements": null, "requestID": "9ffbe15c-96b5-4fe6-bed9-9fccff1a0525", "eventID": "08908de0-2431-4e2e-ba7b-f5424f908433", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }