Logging and monitoring in Resource Groups
All AWS Resource Groups actions are logged in AWS CloudTrail.
Logging AWS Resource Groups API calls with AWS CloudTrail
AWS Resource Groups and Tag Editor are integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Resource Groups or Tag Editor. CloudTrail captures all API calls for Resource Groups as events, including calls from the Resource Groups or Tag Editor console and from code calls to the Resource Groups APIs. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Resource Groups. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the information collected by CloudTrail, you can determine the request that was made to Resource Groups, the IP address from which the request was made, who made the request, when it was made, and additional details.
To learn more about CloudTrail, see the AWS CloudTrail User Guide.
Resource Groups information in CloudTrail
CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Resource Groups, or in the Tag Editor console, that activity is recorded in a CloudTrail event along with other AWS service events in Event history. You can view, search, and download recent events in your AWS account. For more information, see Viewing Events with CloudTrail Event History.
For an ongoing record of events in your AWS account, including events for Resource Groups, 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 regions. The trail logs events from all regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see:
All Resource Groups actions are logged by CloudTrail and are documented in the AWS Resource Groups API Reference.
Resource Groups actions in CloudTrail are shown as events with the API endpoint
resource-groups.amazonaws.com
as their source. For example, calls
to the CreateGroup
, GetGroup
, and
UpdateGroupQuery
actions generate entries in the CloudTrail log files.
Tag Editor actions in the console are logged by CloudTrail, and are shown as events with the
internal API endpoint resource-explorer
as their source.
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 AWS service.
For more information, see the CloudTrail
userIdentity
Element.
Understanding Resource Groups 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 and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files are not an ordered stack trace of the public API calls, so they do not appear in any specific order.
The following example shows a CloudTrail log entry that demonstrates the action
CreateGroup
.
{"eventVersion":"1.05", "userIdentity":{ "type":"AssumedRole", "principalId":"ID number:AWSResourceGroupsUser", "arn":"arn:aws:sts::831000000000:assumed-role/Admin/AWSResourceGroupsUser", "accountId":"831000000000","accessKeyId":"ID number", "sessionContext":{ "attributes":{ "mfaAuthenticated":"false", "creationDate":"2018-06-05T22:03:47Z" }, "sessionIssuer":{ "type":"Role", "principalId":"ID number", "arn":"arn:aws:iam::831000000000:role/Admin", "accountId":"831000000000", "userName":"Admin" } } }, "eventTime":"2018-06-05T22:18:23Z", "eventSource":"resource-groups.amazonaws.com", "eventName":"CreateGroup", "awsRegion":"us-west-2", "sourceIPAddress":"100.25.190.51", "userAgent":"console.amazonaws.com", "requestParameters":{ "Description": "EC2 instances that we are using for application staging.", "Name": "Staging", "ResourceQuery": { "Query": "string", "Type": "TAG_FILTERS_1_0" }, "Tags": { "Key":"Phase", "Value":"Stage" } }, "responseElements":{ "Group": { "Description":"EC2 instances that we are using for application staging.", "groupArn":"arn:aws:resource-groups:us-west-2:831000000000:group/Staging", "Name":"Staging" }, "resourceQuery": { "Query":"string", "Type":"TAG_FILTERS_1_0" } }, "requestID":"de7z64z9-d394-12ug-8081-7zz0386fbcb6", "eventID":"8z7z18dz-6z90-47bz-87cf-e8346428zzz3", "eventType":"AwsApiCall", "recipientAccountId":"831000000000" }