Membuat trail untuk mengirimkan event ke tujuan penyimpanan dan analisis jangka panjang, seperti bucket Object Storage Service (OSS), penyimpanan log Simple Log Service (SLS), atau Proyek MaxCompute.
Deskripsi operasi
By default, a trail that you create by using this API is in a disabled state. You must call the StartLogging operation operation to enable the trail. After a trail is enabled, ActionTrail begins delivering events to your specified destination.
Prerequisites
Before you create a trail, you must have at least one of the following resources configured as a destination:
-
OSS
You must activate OSS and create a bucket.
-
SLS
You must activate SLS and create a Logstore.
CatatanWhen you create a trail with an SLS destination, ActionTrail automatically creates a Logstore named
actiontrail_<trail_name>in your specified project. To ensure the integrity of your audit data, this Logstore only accepts events delivered by ActionTrail. -
MaxCompute
You must activate MaxCompute.
CatatanWhen you create a trail with a MaxCompute destination, ActionTrail automatically creates a project named
actiontrail_<account_ID>. To ensure the integrity of your audit data, this project only accepts events delivered by ActionTrail.
Usage notes
This example shows how to create a single-account trail named trail-test that delivers events to an OSS bucket named audit-log.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
actiontrail:CreateTrail |
create |
*Trail
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
Nama trail. Catatan
|
trail-test |
| OssBucketName |
string |
No |
Nama bucket OSS tempat ActionTrail mengirimkan event.
Catatan
Anda harus menentukan tujuan untuk trail dengan menyediakan setidaknya satu dari parameter berikut: |
audit-log |
| OssKeyPrefix |
string |
No |
Awalan untuk nama file log yang ActionTrail mengirimkan ke bucket OSS Anda.
|
at-product-account-audit-B |
| OssWriteRoleArn |
string |
No |
Nama Sumber Daya Alibaba Cloud (ARN) Peran RAM yang diasumsikan ActionTrail untuk mengirimkan event ke bucket OSS.
|
acs:ram::15127787691****:role/aliyunserviceroleforactiontrail |
| SlsProjectArn |
string |
No |
ARN proyek SLS tempat ActionTrail mengirimkan event. Catatan
Anda harus menentukan tujuan untuk trail dengan menyediakan setidaknya satu dari parameter berikut: |
acs:log:cn-shanghai:151266687691****:project/test-project |
| SlsWriteRoleArn |
string |
No |
ARN Peran RAM yang diasumsikan ActionTrail untuk mengirimkan event ke proyek SLS.
|
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| EventRW |
string |
No |
Menentukan tipe baca/tulis event yang trail mengirimkan. Nilai valid:
|
Write |
| TrailRegion |
string |
No |
Wilayah tempat trail dibuat. Secara default, trail dibuat di semua wilayah dan parameter ini diatur ke |
All |
| IsOrganizationTrail |
boolean |
No |
Apakah akan membuat trail multi-akun. Nilai valid:
Untuk membuat trail untuk organisasi, atur parameter ini ke |
false |
| MaxComputeProjectArn |
string |
No |
ARN proyek MaxCompute tempat ActionTrail mengirimkan event. Catatan
Anda harus menentukan tujuan untuk trail dengan menyediakan setidaknya satu dari parameter berikut: Catatan
Nama proyek dalam ARN harus diawali dengan |
acs:odps:cn-hangzhou:15127787691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
No |
ARN Peran RAM yang diasumsikan ActionTrail untuk mengirimkan event ke proyek MaxCompute.
|
acs:ram::15127787691****:role/aliyunserviceroleforactiontrail |
Untuk informasi lebih lanjut, lihat Parameter umum.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| EventRW |
string |
The read/write type of events that the trail delivers. |
Write |
| HomeRegion |
string |
The home region of the trail. |
cn-hangzhou |
| MaxComputeProjectArn |
string |
The ARN of the MaxCompute project to which the trail delivers events. |
acs:odps:cn-hangzhou:151266687691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
The ARN of the RAM role that ActionTrail assumes to deliver events to the MaxCompute project. |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| Name |
string |
The name of the trail. |
trail-test |
| OssBucketName |
string |
The name of the destination OSS bucket. |
audit-log |
| OssKeyPrefix |
string |
The prefix for the names of log files in the OSS bucket. |
at-product-account-audit-B |
| OssWriteRoleArn |
string |
The ARN of the RAM role that ActionTrail assumes to deliver events to the OSS bucket. |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| RequestId |
string |
The request ID. |
442DDADF-DA58-4029-8E8B-82C73E9A7A70 |
| SlsProjectArn |
string |
The ARN of the SLS project to which the trail delivers events. |
acs:log:cn-hangzhou:151266687691****:project/test-project |
| SlsWriteRoleArn |
string |
The ARN of the RAM role that ActionTrail assumes to deliver events to the SLS project. |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| TrailRegion |
string |
The region in which the trail is created. A value of |
All |
Contoh
Respons sukses
JSONformat
{
"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::151266687691****:role/aliyunserviceroleforactiontrail",
"RequestId": "442DDADF-DA58-4029-8E8B-82C73E9A7A70",
"SlsProjectArn": "acs:log:cn-hangzhou:151266687691****:project/test-project",
"SlsWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
"TrailRegion": "All"
}
Kode kesalahan
|
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. | |
| 400 | InvalidQueryParameter | The specified query parameter is invalid. | |
| 400 | InvalidTrailNameException | The specified Trail name is invalid. | |
| 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. | |
| 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. | |
| 403 | MaximumNumberOfTrailsExceededException | The number of Trails in the same region exceeds the upper limit (5). | |
| 404 | BucketDoesNotExistException | The specified OSS bucket does not exist. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.