Logging Amazon CloudWatch API and console operations with AWS CloudTrail
Amazon CloudWatch, CloudWatch Synthetics, CloudWatch RUM, and CloudWatch Internet Monitor are integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service. CloudTrail captures API calls made by or on behalf of your AWS account. The captured calls include calls from the CloudWatch console and code calls to CloudWatch API operations. Using the information collected by CloudTrail, you can determine the request that was made to CloudWatch, the IP address from which the request was made, when it was made, and additional details.
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 user or user credentials.
-
Whether the request was made on behalf of an IAM Identity Center user.
-
Whether the request was made with temporary security credentials for a role or federated user.
-
Whether the request was made by another AWS service.
CloudTrail is active in your AWS account when you create the account and you automatically have access to the CloudTrail Event history. The CloudTrail Event history provides a viewable, searchable, downloadable, and immutable record of the past 90 days of recorded management events in an AWS Region. For more information, see Working with CloudTrail Event history in the AWS CloudTrail User Guide. There are no CloudTrail charges for viewing the Event history.
For an ongoing record of events in your AWS account past 90 days, create a trail or a CloudTrail Lake event data store.
- CloudTrail trails
-
A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. All trails created using the AWS Management Console are multi-Region. You can create a single-Region or a multi-Region trail by using the AWS CLI. Creating a multi-Region trail is recommended because you capture activity in all AWS Regions in your account. If you create a single-Region trail, you can view only the events logged in the trail's AWS Region. For more information about trails, see Creating a trail for your AWS account and Creating a trail for an organization in the AWS CloudTrail User Guide.
You can deliver one copy of your ongoing management events to your Amazon S3 bucket at no charge from CloudTrail by creating a trail, however, there are Amazon S3 storage charges. For more information about CloudTrail pricing, see AWS CloudTrail Pricing
. For information about Amazon S3 pricing, see Amazon S3 Pricing . - CloudTrail Lake event data stores
-
CloudTrail Lake lets you run SQL-based queries on your events. CloudTrail Lake converts existing events in row-based JSON format to Apache ORC
format. ORC is a columnar storage format that is optimized for fast retrieval of data. Events are aggregated into event data stores, which are immutable collections of events based on criteria that you select by applying advanced event selectors. The selectors that you apply to an event data store control which events persist and are available for you to query. For more information about CloudTrail Lake, see Working with AWS CloudTrail Lake in the AWS CloudTrail User Guide. CloudTrail Lake event data stores and queries incur costs. When you create an event data store, you choose the pricing option you want to use for the event data store. The pricing option determines the cost for ingesting and storing events, and the default and maximum retention period for the event data store. For more information about CloudTrail pricing, see AWS CloudTrail Pricing
.
Note
For information about CloudWatch Logs API calls that are logged in CloudTrail, see CloudWatch Logs information in CloudTrail.
Topics
CloudWatch information in CloudTrail
CloudWatch supports logging the following actions as events in CloudTrail log files:
Example: CloudWatch log file entries
The following example shows a CloudTrail log entry that demonstrates the PutMetricAlarm
action.
{ "Records": [{ "eventVersion": "1.01", "userIdentity": { "type": "Root", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID" }, "eventTime": "2014-03-23T21:50:34Z", "eventSource": "monitoring.amazonaws.com", "eventName": "PutMetricAlarm", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-ruby2/2.0.0.rc4 ruby/1.9.3 x86_64-linux Seahorse/0.1.0", "requestParameters": { "threshold": 50.0, "period": 60, "metricName": "CloudTrail Test", "evaluationPeriods": 3, "comparisonOperator": "GreaterThanThreshold", "namespace": "AWS/CloudWatch", "alarmName": "CloudTrail Test Alarm", "statistic": "Sum" }, "responseElements": null, "requestID": "29184022-b2d5-11e3-a63d-9b463e6d0ff0", "eventID": "b096d5b7-dcf2-4399-998b-5a53eca76a27" }, ..additional entries ] }
The following log file entry shows that a user called the CloudWatch Events
PutRule
action.
{ "eventVersion":"1.03", "userIdentity":{ "type":"Root", "principalId":"123456789012", "arn":"arn:aws:iam::123456789012:root", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext":{ "attributes":{ "mfaAuthenticated":"false", "creationDate":"2015-11-17T23:56:15Z" } } }, "eventTime":"2015-11-18T00:11:28Z", "eventSource":"events.amazonaws.com", "eventName":"PutRule", "awsRegion":"us-east-1", "sourceIPAddress":"AWS Internal", "userAgent":"AWS CloudWatch Console", "requestParameters":{ "description":"", "name":"cttest2", "state":"ENABLED", "eventPattern":"{\"source\":[\"aws.ec2\"],\"detail-type\":[\"EC2 Instance State-change Notification\"]}", "scheduleExpression":"" }, "responseElements":{ "ruleArn":"arn:aws:events:us-east-1:123456789012:rule/cttest2" }, "requestID":"e9caf887-8d88-11e5-a331-3332aa445952", "eventID":"49d14f36-6450-44a5-a501-b0fdcdfaeb98", "eventType":"AwsApiCall", "apiVersion":"2015-10-07", "recipientAccountId":"123456789012" }
The following log file entry shows that a user called the CloudWatch Logs
CreateExportTask
action.
{ "eventVersion": "1.03", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:user/someuser", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "someuser" }, "eventTime": "2016-02-08T06:35:14Z", "eventSource": "logs.amazonaws.com", "eventName": "CreateExportTask", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-ruby2/2.0.0.rc4 ruby/1.9.3 x86_64-linux Seahorse/0.1.0", "requestParameters": { "destination": "yourdestination", "logGroupName": "yourloggroup", "to": 123456789012, "from": 0, "taskName": "yourtask" }, "responseElements": { "taskId": "15e5e534-9548-44ab-a221-64d9d2b27b9b" }, "requestID": "1cd74c1c-ce2e-12e6-99a9-8dbb26bd06c9", "eventID": "fd072859-bd7c-4865-9e76-8e364e89307c", "eventType": "AwsApiCall", "apiVersion": "20140328", "recipientAccountId": "123456789012" }
CloudWatch data events in CloudTrail
CloudTrail can capture API activities related to the CloudWatch data plane operations GetMetricData and GetMetricWidgetImage.
Data events, also known as data plane operations, give you insight into the resource operations performed on or within a resource. Data events are often high-volume activities.
By default, CloudTrail doesn’t log data events. The CloudTrail Event history doesn't record data events.
Additional charges apply for data events. For more information about CloudTrail pricing, see
AWS CloudTrail Pricing
You can log data events for the CloudWatch resource types by using the CloudTrail console, AWS CLI, or CloudTrail API operations. For more information about how to log data events, see Logging data events with the AWS Management Console and Logging data events with the AWS Command Line Interface in the AWS CloudTrail User Guide.
Data plane events can be filtered by resource type. Because there are additional costs for using data events in CloudTrail, filtering by resource allows you to have more control over what you log and pay for.
Using the information that CloudTrail collects, you can identify a specific request to the CloudWatch GetMetricData or GetMetricWidgetImage APIs, the IP address of the requester, the requester's identity, and the date and time of the request. Logging the GetMetricData and GetMetricWidgetImage APIs using CloudTrail helps you enable operational and risk auditing, governance, and compliance of your AWS account.
Note
When you view the GetMetricData events in CloudTrail, you might see more calls than the calls that you initiated. This is because CloudWatch logs events to CloudTrail for GetMetricData actions that are initiated by internal components. For example, you'll see GetMetricData calls initiated by CloudWatch dashboards to refresh widget data, and GetMetricData calls initiated by a monitoring account to retrieve data from a source account, in cross-account observability. These internally-initiated calls don't incur CloudWatch charges, but they do count toward the number of events logged in CloudTrail, and CloudTrail charges according to the number of events logged.
The following is an example of a CloudTrail event for a GetMetricData operation.
{ "eventVersion": "1.09", "userIdentity": { "type": "IAMUser", "principalId": "AIDA2NYTR2EPCTNY7AF3L", "arn": "arn:aws:iam::111122223333:user/admin", "accountId": "111122223333", "accessKeyId": "EXAMPLE1234567890", "userName": "admin" }, "eventTime": "2024-05-08T16:20:34Z", "eventSource": "monitoring.amazonaws.com", "eventName": "GetMetricData", "awsRegion": "us-east-1", "sourceIPAddress": "99.45.3.7", "userAgent": "aws-cli/2.13.23 Python/3.11.5 Darwin/23.4.0 exe/x86_64 prompt/off command/cloudwatch.get-metric-data", "requestParameters": { "metricDataQueries": [{ "id": "e1", "expression": "m1 / m2", "label": "ErrorRate" }, { "id": "m1", "metricStat": { "metric": { "namespace": "CWAgent", "metricName": "disk_used_percent", "dimensions": [{ "name": "LoadBalancerName", "value": "EXAMPLE4623a5cb6a7384c5229" }] }, "period": 300, "stat": "Sum", "unit": "Count" }, "returnData": false }, { "id": "m2", "metricStat": { "metric": { "namespace": "CWAgent", "metricName": "disk_used_percent", "dimensions": [{ "name": "LoadBalancerName", "value": "EXAMPLE4623a5cb6a7384c5229" }] }, "period": 300, "stat": "Sum" }, "returnData": true } ], "startTime": "Apr 19, 2024, 4:00:00 AM", "endTime": "May 8, 2024, 4:30:00 AM" }, "responseElements": null, "requestID": "EXAMPLE-57ac-47d5-938c-f5917c6799d5", "eventID": "EXAMPLE-211c-404b-b13d-36d93c8b4fbf", "readOnly": true, "resources": [{ "type": "AWS::CloudWatch::Metric" }], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "111122223333", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.3", "cipherSuite": "TLS_AES_128_GCM_SHA256", "clientProvidedHostHeader": "monitoring.us-east-1.amazonaws.com" } }
Query generation information in CloudTrail
CloudTrail logging for Query generator console events is also supported. Query generator is currently supported for
CloudWatch Metric Insights and CloudWatch Logs Insights. In these CloudTrail events, the eventSource
is monitoring.amazonaws.com
.
The following example shows a CloudTrail log entry that demonstrates the GenerateQuery action in CloudWatch Metrics Insights.
{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:assumed-role/role_name", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::111222333444:role/Administrator", "accountId": "123456789012", "userName": "SAMPLE_NAME" }, "attributes": { "creationDate": "2020-04-08T21:43:24Z", "mfaAuthenticated": "false" } } }, "eventTime": "2020-04-08T23:06:30Z", "eventSource": "monitoring.amazonaws.com", "eventName": "GenerateQuery", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "exampleUserAgent", "requestParameters": { "query_ask": "***", "query_type": "MetricsInsights", "metrics_insights": { "aws_namespaces": [ "AWS/S3", "AWS/Lambda", "AWS/DynamoDB" ] }, "include_description": true }, "responseElements": null, "requestID": "2f56318c-cfbd-4b60-9d93-1234567890", "eventID": "52723fd9-4a54-478c-ac55-1234567890", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }
CloudWatch Internet Monitor in CloudTrail
CloudWatch Internet Monitor supports logging the following actions as events in CloudTrail log files.
Example: CloudWatch Internet Monitor log file entries
The following example shows a CloudTrail Internet Monitor log entry that demonstrates the
ListMonitors
action.
{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::000000000000:assumed-role/role_name", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::000000000000:role/Admin", "accountId":"123456789012", "userName": "SAMPLE_NAME" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-10-11T17:25:41Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-10-11T17:30:18Z", "eventSource": "internetmonitor.amazonaws.com", "eventName": "ListMonitors", "awsRegion": "us-east-2", "sourceIPAddress": "192.0.2.0", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)", "requestParameters": null, "responseElements": null, "requestID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLEbbbbb", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }
The following example shows a CloudTrail Internet Monitor log entry that demonstrates the
CreateMonitor
action.
{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::000000000000:assumed-role/role_name", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::000000000000:role/Admin", "accountId":"123456789012", "userName": "SAMPLE_NAME" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-10-11T17:25:41Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-10-11T17:30:08Z", "eventSource": "internetmonitor.amazonaws.com", "eventName": "CreateMonitor", "awsRegion": "us-east-2", "sourceIPAddress": "192.0.2.0", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)", "requestParameters": { "MonitorName": "TestMonitor", "Resources": ["arn:aws:ec2:us-east-2:444455556666:vpc/vpc-febc0b95"], "ClientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333" }, "responseElements": { "Arn": "arn:aws:internetmonitor:us-east-2:444455556666:monitor/ct-onboarding-test", "Status": "PENDING" }, "requestID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLEbbbbb", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }
CloudWatch Synthetics information in CloudTrail
CloudWatch Synthetics supports logging the following actions as events in CloudTrail log files:
Example: CloudWatch Synthetics log file entries
The following example shows a CloudTrail Synthetics log entry that demonstrates the
DescribeCanaries
action.
{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:assumed-role/role_name", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::111222333444:role/Administrator", "accountId":"123456789012", "userName": "SAMPLE_NAME" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-04-08T21:43:24Z" } } }, "eventTime": "2020-04-08T23:06:47Z", "eventSource": "synthetics.amazonaws.com", "eventName": "DescribeCanaries", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-internal/3 aws-sdk-java/1.11.590 Linux/4.9.184-0.1.ac.235.83.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.212-b03 java/1.8.0_212 vendor/Oracle_Corporation", "requestParameters": null, "responseElements": null, "requestID": "201ed5f3-15db-4f87-94a4-123456789", "eventID": "73ddbd81-3dd0-4ada-b246-123456789", "readOnly": true, "eventType": "AwsApiCall", "recipientAccountId": "111122223333" }
The following example shows a CloudTrail Synthetics log entry that demonstrates the
UpdateCanary
action.
{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:assumed-role/role_name", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::111222333444:role/Administrator", "accountId":"123456789012", "userName": "SAMPLE_NAME" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-04-08T21:43:24Z" } } }, "eventTime": "2020-04-08T23:06:47Z", "eventSource": "synthetics.amazonaws.com", "eventName": "UpdateCanary", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "aws-internal/3 aws-sdk-java/1.11.590 Linux/4.9.184-0.1.ac.235.83.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.212-b03 java/1.8.0_212 vendor/Oracle_Corporation", "requestParameters": { "Schedule": { "Expression": "rate(1 minute)" }, "name": "sample_canary_name", "Code": { "Handler": "myOwnScript.handler", "ZipFile": "SAMPLE_ZIP_FILE" } }, "responseElements": null, "requestID": "fe4759b0-0849-4e0e-be71-1234567890", "eventID": "9dc60c83-c3c8-4fa5-bd02-1234567890", "readOnly": false, "eventType": "AwsApiCall", "recipientAccountId": "111122223333" }
The following example shows a CloudTrail Synthetics log entry that demonstrates the
GetCanaryRuns
action.
{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:assumed-role/role_name", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::111222333444:role/Administrator", "accountId":"123456789012", "userName": "SAMPLE_NAME" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-04-08T21:43:24Z" } } }, "eventTime": "2020-04-08T23:06:30Z", "eventSource": "synthetics.amazonaws.com", "eventName": "GetCanaryRuns", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-internal/3 aws-sdk-java/1.11.590 Linux/4.9.184-0.1.ac.235.83.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.212-b03 java/1.8.0_212 vendor/Oracle_Corporation", "requestParameters": { "Filter": "TIME_RANGE", "name": "sample_canary_name", "FilterValues": [ "2020-04-08T23:00:00.000Z", "2020-04-08T23:10:00.000Z" ] }, "responseElements": null, "requestID": "2f56318c-cfbd-4b60-9d93-1234567890", "eventID": "52723fd9-4a54-478c-ac55-1234567890", "readOnly": true, "eventType": "AwsApiCall", "recipientAccountId": "111122223333" }
CloudWatch RUM information in CloudTrail
CloudWatch RUM supports logging the following actions as events in CloudTrail log files:
Example: CloudWatch RUM log file entries
This section contains example CloudTrail entries for some CloudWatch RUM APIs.
The following example shows a CloudTrail log entry that demonstrates the CreateAppMonitor action.
{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::777777777777:assumed-role/EXAMPLE", "accountId": "777777777777", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::777777777777:role/EXAMPLE", "accountId": "777777777777", "userName": "USERNAME_EXAMPLE" }, "attributes": { "creationDate": "2024-07-23T16:48:47Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-07-23T18:02:57Z", "eventSource": "rum.amazonaws.com", "eventName": "CreateAppMonitor", "awsRegion": "us-east-1", "sourceIPAddress": "54.240.198.39", "userAgent": "aws-internal/3 aws-sdk-java/1.12.641 Linux/5.10.219-186.866.amzn2int.x86_64 OpenJDK_64-Bit_Server_VM/25.402-b08 java/1.8.0_402 vendor/Oracle_Corporation cfg/retry-mode/standard", "requestParameters": { "CustomEvents": { "Status": "ENABLED" }, "CwLogEnabled": true, "Domain": "*.github.io", "AppMonitorConfiguration": { "SessionSampleRate": 1, "IncludedPages": [], "ExcludedPages": [], "Telemetries": [ "performance", "errors", "http" ], "EnableXRay": false, "AllowCookies": true, "IdentityPoolId": "us-east-1:c81b9a1c-a5c9-4de5-8585-eb8df04e66f0" }, "Tags": { "TestAppMonitor": "" }, "Name": "TestAppMonitor" }, "responseElements": { "Id": "65a8cc63-4ae8-4f2c-b5fc-4a54ef43af51" }, "requestID": "cf7c30ad-25d3-4274-bab1-39c95a558007", "eventID": "2d43cc69-7f89-4f1a-95ae-0fc7e9b9fb3b", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "777777777777", "eventCategory": "Management" }
The following example shows a CloudTrail log entry that demonstrates the PutRumMetricsDestination action.
{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::777777777777:assumed-role/EXAMPLE", "accountId": "777777777777", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::777777777777:role/EXAMPLE", "accountId": "777777777777", "userName": "USERNAME_EXAMPLE" }, "attributes": { "creationDate": "2024-07-23T16:48:47Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-07-23T18:22:22Z", "eventSource": "rum.amazonaws.com", "eventName": "PutRumMetricsDestination", "awsRegion": "us-east-1", "sourceIPAddress": "52.94.133.142", "userAgent": "aws-cli/2.13.25 Python/3.11.5 Linux/5.10.219-186.866.amzn2int.x86_64 exe/x86_64.amzn.2 prompt/off command/rum.put-rum-metrics-destination", "requestParameters": { "Destination": "CloudWatch", "AppMonitorName": "TestAppMonitor" }, "responseElements": null, "requestID": "9b03fcce-b3a2-44fc-b771-900e1702998a", "eventID": "6250f9b7-0505-4f96-9668-feb64f82de5b", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "777777777777", "eventCategory": "Management" }
The following example shows a CloudTrail log entry that demonstrates the BatchCreateRumMetricsDefinitions action.
{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::777777777777:assumed-role/EXAMPLE", "accountId": "777777777777", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::777777777777:role/EXAMPLE", "accountId": "777777777777", "userName": "USERNAME_EXAMPLE" }, "attributes": { "creationDate": "2024-07-23T16:48:47Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-07-23T18:23:11Z", "eventSource": "rum.amazonaws.com", "eventName": "BatchCreateRumMetricDefinitions", "awsRegion": "us-east-1", "sourceIPAddress": "52.94.133.142", "userAgent": "aws-cli/2.13.25 Python/3.11.5 Linux/5.10.219-186.866.amzn2int.x86_64 exe/x86_64.amzn.2 prompt/off command/rum.batch-create-rum-metric-definitions", "requestParameters": { "Destination": "CloudWatch", "MetricDefinitions": [ { "Name": "NavigationToleratedTransaction", "Namespace": "AWS/RUM", "DimensionKeys": { "metadata.browserName": "BrowserName" }, "EventPattern": "{\"metadata\":{\"browserName\":[\"Chrome\"]},\"event_type\":[\"com.amazon.rum.performance_navigation_event\"],\"event_details\": {\"duration\": [{\"numeric\": [\"<=\",2000,\"<\",8000]}]}}" }, { "Name": "HttpErrorCount", "DimensionKeys": { "metadata.browserName": "BrowserName", "metadata.countryCode": "CountryCode" }, "EventPattern": "{\"metadata\":{\"browserName\":[\"Chrome\"], \"countryCode\":[\"US\"]},\"event_type\":[\"com.amazon.rum.http_event\"]}" } ], "AppMonitorName": "TestAppMonitor" }, "responseElements": { "Errors": [], "MetricDefinitions": [] }, "requestID": "b14c5eda-f107-48e5-afae-1ac20d0962a8", "eventID": "001b55c6-1de1-48c0-a236-31096dffe249", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "777777777777", "eventCategory": "Management" }
CloudWatch RUM data plane events in CloudTrail
CloudTrail can capture API activities related to the CloudWatch RUM data plane operation PutRumEvents.
Data events, also known as data plane operations, give you insight into the resource operations performed on or within a resource. Data events are often high-volume activities.
To enable logging of the PutRumEvents data events in CloudTrail files, you'll need to enable the logging of data plane API activity in CloudTrail. See Logging data events for trails for more information.
Data plane events can be filtered by resource type. Because there are additional costs for using data events in CloudTrail, filtering by resource allows you to have more control over what you log and pay for.
Using the information that CloudTrail collects, you can identify a specific request to the CloudWatch RUM PutRumEvents API, the IP address of the requester, the requester's identity, and the date and time of the request. Logging the PutRumEvents API using CloudTrail helps you enable operational and risk auditing, governance, and compliance of your AWS account.
The following example shows a CloudTrail log entry that demonstrates the PutRumEvents action.
{ "Records": [ { "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::777777777777:assumed-role/EXAMPLE", "accountId": "777777777777", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::777777777777:role/EXAMPLE", "accountId": "777777777777", "userName": "USERNAME_EXAMPLE" }, "attributes": { "creationDate": "2024-05-16T20:32:39Z", "mfaAuthenticated": "false" } }, "invokedBy": "AWS Internal" }, "eventTime": "2024-05-16T20:32:42Z", "eventSource": "rum.amazonaws.com", "eventName": "PutRumEvents", "awsRegion": "us-east-1", "sourceIPAddress": "AWS Internal", "userAgent": "AWS Internal", "requestParameters": { "id": "73ddbd81-1234-5678-b246-123456789", "batchId": "123456-3dd0-4ada-b246-123456789", "appMonitorDetails": { "name": "APP-MONITOR-NAME", "id": "123456-3dd0-4ada-b246-123456789", "version": "1.0.0" }, "userDetails": { "userId": "73ddbd81-1111-9999-b246-123456789", "sessionId": "a1b2c3456-15db-4f87-6789-123456789" }, "rumEvents": [ { "id": "201f367a-15db-1234-94a4-123456789", "timestamp": "May 16, 2024, 8:32:20 PM", "type": "com.amazon.rum.dom_event", "metadata": "{}", "details": "{}" } ] }, "responseElements": null, "requestID": "201ed5f3-15db-4f87-94a4-123456789", "eventID": "73ddbd81-3dd0-4ada-b246-123456789", "readOnly": false, "resources": [ { "accountId": "777777777777", "type": "AWS::RUM::AppMonitor", "ARN": "arn:aws:rum:us-east-1:777777777777:appmonitor/APPMONITOR_NAME_EXAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "777777777777", "eventCategory": "Data" } ] }