ActionTrail records events for each Alibaba Cloud account for the last 90 days by default. To track events that occurred more than 90 days ago, you can create a trail to deliver operation events to Object Storage Service (OSS), Simple Log Service, or MaxCompute for event analysis.
Operation description
Trails created through the API are in the shutdown state by default. You need to call the StartLogging operation to enable the trail before ActionTrail can deliver operation events to the target cloud product.
Prerequisites
Before you create a trail, ensure that you have completed at least one of the following storage configurations:
-
Deliver to Object Storage Service (OSS)
Make sure you have activated Object Storage Service and created a bucket.
-
Deliver to Simple Log Service
Make sure you have activated Simple Log Service and created a log project.
NoteWhen you create a trail, ActionTrail automatically creates a Logstore named
actiontrail_<trail name>in the target log project. This Logstore prohibits other data from being written to ensure the accuracy of audit data. -
Deliver to MaxCompute
Make sure you have activated MaxCompute.
NoteWhen you create a trail, ActionTrail automatically creates a project named
actiontrail_<account ID>in project management. This project prohibits other data from being written to ensure the accuracy of audit data.
Usage notes
This topic provides an example of creating a single-account trail named trail-test that delivers operation events to an OSS bucket named audit-log.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
actiontrail:CreateTrail |
create |
*Trail
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
The name of the trail to be created. Note
Trail names must be unique within the same account. |
trail-test |
| OssBucketName |
string |
No |
The OSS bucket to which the trail delivers logs. Note
You must specify at least one of the following parameters: OssBucketName, SlsProjectArn, or MaxComputeProjectArn. |
audit-log |
| OssKeyPrefix |
string |
No |
The prefix of the file name in the OSS bucket to which the trail delivers logs. This parameter can be left empty. |
at-product-account-audit-B |
| OssWriteRoleArn |
string |
No |
The Alibaba Cloud Resource Name (ARN) of the role that ActionTrail assumes to deliver operation events to the OSS bucket.
|
acs:ram::***:role/aliyunserviceroleforactiontrail |
| SlsProjectArn |
string |
No |
The ARN of the Simple Log Service project to which the trail delivers logs. Note
You must specify at least one of the following parameters: OssBucketName, SlsProjectArn, or MaxComputeProjectArn. |
acs:log:cn-shanghai::project/*** |
| SlsWriteRoleArn |
string |
No |
The ARN of the role that ActionTrail assumes to deliver operation events to the Simple Log Service project.
|
acs:ram::***:role/aliyunserviceroleforactiontrail |
| EventRW |
string |
No |
The read/write type of the events to be delivered. Valid values:
|
Write |
| TrailRegion |
string |
No |
The region of the trail. |
All |
| IsOrganizationTrail |
boolean |
No |
Specifies whether to create a multi-account trail. Valid values:
|
false |
| MaxComputeProjectArn |
string |
No |
The ARN of the MaxCompute project to which the trail delivers logs. Note
You must specify at least one of the following parameters: OssBucketName, SlsProjectArn, or MaxComputeProjectArn. Note
The name of the MaxCompute project specified in MaxComputeProjectArn must start with the actiontrail_ prefix. |
acs:odps:cn-hangzhou:15127787691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
No |
The ARN of the role that ActionTrail assumes to deliver operation events to the MaxCompute project.
|
acs:ram::15127787691****:role/aliyunserviceroleforactiontrail |
For more information, see Common parameters.
Response parameters
|
Parameter |
Type |
Description |
Example |
|
object |
|||
| EventRW |
string |
The read/write type of the events to be delivered. |
Write |
| HomeRegion |
string |
The home region of the trail. |
cn-hangzhou |
| MaxComputeProjectArn |
string |
The ARN of the MaxCompute project to which the trail delivers logs. |
acs:odps:cn-hangzhou:151266687691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
The ARN of the role that ActionTrail assumes to deliver operation events to the MaxCompute project. |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| Name |
string |
The name of the trail. |
trail-test |
| OssBucketName |
string |
The OSS bucket. |
audit-log |
| OssKeyPrefix |
string |
The prefix of the file name in the OSS bucket. |
at-product-account-audit-B |
| OssWriteRoleArn |
string |
The ARN of the role that ActionTrail assumes to deliver operation events to the OSS bucket. |
acs:ram::***:role/aliyunserviceroleforactiontrail |
| RequestId |
string |
The request ID. |
442DDADF-DA58-4029-8E8B-82C73E9A7A70 |
| SlsProjectArn |
string |
The ARN of the Simple Log Service project to which the trail delivers logs. |
acs:log:cn-hangzhou:151266687691****:project/test-project |
| SlsWriteRoleArn |
string |
The ARN of the role that ActionTrail assumes to deliver operation events to the Simple Log Service project. |
acs:ram::***:role/aliyunserviceroleforactiontrail |
| TrailRegion |
string |
The region of the trail. |
All |
Examples
Success response
JSON format
{
"EventRW": "Write",
"HomeRegion": "cn-hangzhou",
"MaxComputeProjectArn": "acs:odps:cn-hangzhou:151266687691****:project/actiontrail_****",
"MaxComputeWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
"Name": "trail-test",
"OssBucketName": "audit-log",
"OssKeyPrefix": "at-product-account-audit-B",
"OssWriteRoleArn": "acs:ram::***:role/aliyunserviceroleforactiontrail",
"RequestId": "442DDADF-DA58-4029-8E8B-82C73E9A7A70",
"SlsProjectArn": "acs:log:cn-hangzhou:151266687691****:project/test-project",
"SlsWriteRoleArn": "acs:ram::***:role/aliyunserviceroleforactiontrail",
"TrailRegion": "All"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidDeliveryConfigurationException | You must specify at least one Log Service project or OSS bucket for a Trail. | |
| 400 | InvalidPrefixException | The specified OSS bucket prefix is invalid. | The specified OSS bucket prefix is not valid. |
| 400 | InvalidQueryParameter | The specified query parameter is invalid. | The specified query parameter is not valid. |
| 400 | InvalidTrailNameException | The specified Trail name is invalid. | The specified Trail name is not valid. |
| 400 | RepeatOssBucket | The specified OSS bucket is already in use. We recommend that you modify the existing Trail or specify another bucket. | |
| 400 | SlsProjectDoesNotExistException | The specified Log Service project does not exist. | |
| 400 | TrailAlreadyExistsException | The specified Trail name already exists. | The specified Trail name already exists,if you want to create a new Trail,please use another Trail name. |
| 400 | MaximumNumberOfOrganizationTrailExceeded | Your account can create only one organization trail. | |
| 400 | NotAllowCreateOrganizationTrail | Your account does not allow you to create organization trail. Submit a ticket to get customer support. | |
| 403 | InsufficientBucketPolicyException | Access to the specified OSS bucket was denied. | |
| 403 | InsufficientSlsPolicyException | Access to the specified Log Service project was denied. | Access SLS Project denied. |
| 403 | MaximumNumberOfTrailsExceededException | The number of Trails in the same region exceeds the upper limit (5). | The number of Trail in same region has exceeded the limit 5 |
| 404 | BucketDoesNotExistException | The specified OSS bucket does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.