Log and monitor with AWS CloudTrail - Amazon Location Service

Log and monitor with AWS CloudTrail

AWS CloudTrail is a service that provides a record of actions taken by a user, role, or an AWS service. CloudTrail records all API calls as events. You can use Amazon Location Service with CloudTrail to monitor your API calls, which include calls from the Amazon Location Service console and AWS SDK calls to the Amazon Location Service API operations.

When you create a trail, you can enable continuous delivery of CloudTrail events to an S3 bucket, including events for Amazon Location Service. 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 Amazon Location Service, the IP address from which the request was made, who made the request, when it was made, and additional details.

For more information about CloudTrail, see the AWS CloudTrail User Guide.

Amazon Location Service Information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Amazon Location Service, 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 Amazon Location Service, create a trail. A trail enables CloudTrail to deliver log files to an S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the 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 the following:

All Amazon Location Service actions are logged by CloudTrail and are documented in the Amazon Location Service API references. For example, calls to the CreateTracker, UpdateTracker and DescribeTracker actions 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 whether the request was made:

  • With root or AWS Identity and Access Management (IAM) user credentials.

  • With temporary security credentials for a role or federated user.

  • By another AWS service.

For more information, see the CloudTrail userIdentity Element.

Learn about Amazon Location Service log file entries

A trail is a configuration that enables delivery of events as log files to an S3 bucket that you specify, or to Amazon CloudWatch Logs. For more information, see Working with CloudTrail log files in the AWS CloudTrail User Guide.

CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested operation, the date and time of the operation, request parameters, and so on.

Note

CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order. To determine the order of operations, use eventTime.

The following example shows a CloudTrail log entry that demonstrates the CreateTracker operation, which creates a tracker resource.

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "123456789012", "arn": "arn:aws:geo:us-east-1:123456789012:tracker/ExampleTracker" "accountId": "123456789012", "accessKeyId": "123456789012", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "123456789012", "arn": "arn:aws:geo:us-east-1:123456789012:tracker/ExampleTracker", "accountId": "123456789012", "userName": "exampleUser", }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-10-22T16:36:07Z" } } }, "eventTime": "2020-10-22T17:43:30Z", "eventSource": "geo.amazonaws.com", "eventName": "CreateTracker", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0/24—TEST-NET-1", "userAgent": "aws-internal/3 aws-sdk-java/1.11.864 Linux/4.14.193-110.317.amzn2.x86_64 OpenJDK_64-Bit_Server_VM/11.0.8+10-LTS java/11.0.8 kotlin/1.3.72 vendor/Amazon.com_Inc. exec-env/AWS_Lambda_java11", "requestParameters": { "TrackerName": "ExampleTracker", "Description": "Resource description" }, "responseElements": { "TrackerName": "ExampleTracker", "Description": "Resource description" "TrackerArn": "arn:partition:service:region:account-id:resource-id", "CreateTime": "2020-10-22T17:43:30.521Z" }, "requestID": "557ec619-0674-429d-8e2c-eba0d3f34413", "eventID": "3192bc9c-3d3d-4976-bbef-ac590fa34f2c", "readOnly": false, "eventType": "AwsApiCall", "recipientAccountId": "123456789012", }

The following shows a log entry for the DescribeTracker operation, which returns the details of a tracker resource.

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "123456789012", "arn": "arn:partition:service:region:account-id:resource-id", "accountId": "123456789012", "accessKeyId": "123456789012", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "123456789012", "arn": "arn:partition:service:region:account-id:resource-id", "accountId": "123456789012", "userName": "exampleUser", }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-10-22T16:36:07Z" } } }, "eventTime": "2020-10-22T17:43:33Z", "eventSource": "geo.amazonaws.com", "eventName": "DescribeTracker", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0/24—TEST-NET-1", "userAgent": "aws-internal/3 aws-sdk-java/1.11.864 Linux/4.14.193-110.317.amzn2.x86_64 OpenJDK_64-Bit_Server_VM/11.0.8+10-LTS java/11.0.8 kotlin/1.3.72 vendor/Amazon.com_Inc. exec-env/AWS_Lambda_java11", "requestParameters": { "TrackerName": "ExampleTracker" }, "responseElements": null, "requestID": "997d5f93-cfef-429a-bbed-daab417ceab4", "eventID": "d9e0eebe-173c-477d-b0c9-d1d8292da103", "readOnly": true, "eventType": "AwsApiCall", "recipientAccountId": "123456789012", }