A single-account trail can continuously deliver events to the specified Object Storage
Service (OSS) bucket or Log Service Logstore for analysis. By default, ActionTrail
records the events that were generated within your Alibaba Cloud account in the last
90 days. You can query these events in the ActionTrail console. To query the events
that were generated more than 90 days ago, you must create a trail first to record
these events. This topic describes how to create a single-account trail in the ActionTrail
console.
Prerequisites
The permissions to manage insight events are granted to you after you request the
permissions by submitting a ticket.
Background information
If you create a trail by using your Alibaba Cloud account, ActionTrail delivers events
related to the Alibaba Cloud account and its RAM users to the delivery destination.
If you create a trail as a RAM user, the RAM user must be granted the permissions
to create and manage single-account trails. For more information, see Grant permissions to a RAM user.
ActionTrail allows you to create multiple single-account trails. To prevent repeated
recording of global events, ActionTrail applies the following rules to global events:
- You can view all the global events in the ActionTrail console, regardless of the region
that you specify.
- After you create a single-account trail to deliver events to a specified OSS bucket,
global events are recorded in the same file as the events that are generated in the
region in which the trail is created.
Procedure
- Log on to the ActionTrail console.
- In the left-side navigation pane, click Trails.
- In the top navigation bar, select the region in which you want to create a single-account
trail.
Note The region that you select becomes the home region of the trail that you want to create.
- On the Trails page, click Create Trail.
- In the Trail Basic Settings step, set the parameters and click Next. The following table describes the parameters.
Parameter |
Description |
Trail Name |
The name of the trail that you want to create. The name must be unique within your
Alibaba Cloud account. The trail name is used to name the Logstore that is used to
store the events to be delivered.
|
Log Event |
The category of event that you want to deliver. Valid values:
- Management Event: By default, Management Event is selected. You can select the type of user-initiated
event that you want to deliver. Valid values:
- All Events: all read and write events. All events must be recorded for auditing, as stipulated
in the auditing-related regulations and standards. We recommend that you select All Events.
- Write: the events that record the operations to create, delete, or modify cloud resources.
For example, a CreateInstance event is generated when a subscription or pay-as-you-go
Elastic Compute Service (ECS) instance is created. If you need to export events only
for analysis and focus only on the events that affect the O&M of cloud resources,
select Write.
- Read: the events that record the operations to read information about cloud resources,
rather than to create, delete, or modify cloud resources. For example, a DescribeInstances
event is generated when the details of one or more ECS instances are queried. Read
events are often generated in abundance and occupy large storage space. However, all
events must be recorded for auditing, as stipulated in the auditing-related regulations
and standards. We recommend that you configure the trail to deliver both read and
write events. This helps you track the use of AccessKey pairs and access to cloud
resources.
- Insight Event: Select or clear Insight Event as needed. If you select Insight Event, ActionTrail
synchronously delivers insight events that are generated due to operations from unusual
IP addresses.
Note
- By default, when you create a trail in the ActionTrail console, the system assumes
that the trail delivers events in all regions. To create a trail that delivers events
in specific regions, call the CreateTrail operation. Set the TrailRegion parameter as needed when you call this operation.
- If you select Insight Event, the Event Type parameter is automatically set to All
Events.
|
- In the Event Delivery Settings step, specify one or more delivery destinations and click Next.
You can create a trail to deliver events to Log Service, OSS, or both. For more information
about how to select a storage service, see
Deliver events to specified Alibaba Cloud services.
Note The events generated after the single-account trail takes effect are delivered. The
events generated in the last 90 days are excluded. To meet your requirements to the
greatest extent possible, you can create a historical event delivery task to deliver
the events generated in the last 90 days to the delivery destination that you specify
for the trail at a time. For more information, see
Create a historical event delivery task.
- Select Delivery to Log Service
- If you select Delivery to Current Account, set the parameters that are described in the following table.
Parameter |
Description |
Logstore Region |
The region in which the Log Service project resides. |
Project Name |
The name of the Log Service project. The project name must be unique within an Alibaba
Cloud account.
|
- If you select Delivery to Another Account, set the Log Service Project ARN and RAM Role ARN of Destination Account parameters.
To deliver events to another account, you must create a RAM role by using the destination
account, grant ActionTrail the permissions to deliver events to the destination account,
and then create a Log Service project before you create the trail. For more information,
see Aggregate events across Alibaba Cloud accounts.
- Select Delivery to OSS
- If you select Delivery to Current Account, set the parameters that are described in the following table.
Parameter |
Description |
Bucket Name |
The name of the OSS bucket. The bucket name must be unique within the Alibaba Cloud
account.
Notice You must complete real-name registration on the Real-name Registration page before you create a bucket in a region within the Chinese mainland.
|
Log File Prefix |
The prefix of the names of the log files in which the delivered events are stored.
The prefix helps you find the events in subsequent operations.
|
Server Encryption |
Specifies whether and how to encrypt objects in the OSS bucket. If you select New OSS Bucket, you must set the parameter. Valid values:
- Fully Managed by OSS
- KMS
- No
|
- If you select Delivery to Another Account, set the RAM Role ARN of OSS Bucket, Bucket Name, and Log File Prefix parameters.
To deliver events to another account, you must create a RAM role by using the destination
account, grant ActionTrail the permissions to deliver events to the destination account,
and then create an OSS bucket before you create the trail. For more information, see
Aggregate events across Alibaba Cloud accounts.
- In the Preview and Create step, confirm the trail information and click Submit.
You can click View Details to view the details of the trail.
Result
After you create a single-account trail, the trail delivers events to the OSS bucket
or Log Service Logstore that you specify in the JSON format for query and analysis.
You can view the events that are stored in the OSS bucket or Log Service Logstore.
- Query events in the Log Service console: ActionTrail automatically creates a Logstore
named in the format of
actiontrail_<Trail name>
. To query and analyze events in the Log Service console, go to the Trails page of the ActionTrail console first. Find the trail that you created, move the
pointer over the
icon in the Storage Service column, and then click the name of the Logstore.
- Query events in the OSS console: You can analyze the delivered events by using E-MapReduce
(EMR) or a third-party log analysis service.
To query and analyze events in the OSS console, go to the Trails page of the ActionTrail console first. Find the trail that you created, move the
pointer over the
icon in the Storage Service column, and then click the name of the OSS bucket. On the bucket overview page, click
Files in the left-side navigation pane. For more information about the storage paths in
OSS, see What is the storage path of an event that is delivered to an OSS bucket?