This topic describes how to create a multi-account trail in the ActionTrail console. A multi-account trail delivers the events of all members in a resource directory to a Log Service Logstore or an Object Storage Service (OSS) bucket.
Prerequisites
A resource directory is enabled. For more information, see Enable a resource directory.
Background information
Procedure
- Log on to the ActionTrail console by using the delegated administrator account or the management account of your resource directory. For more information about how to specify a member as the delegated administrator account, see Manage a delegated administrator account.
- In the left-side navigation pane, click Trails.
- In the top navigation bar, select the region in which you want to create a multi-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.
- On the Create Trail page, configure the parameters.
- Basic Information
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 name is used for the Logstore in which you want to store the delivered events. Specify the name in the actiontrail_<Trail name>
format.Log Events The events that you want to deliver. By default, Management Event is selected. The system delivers the management events that record the operations to manage cloud resources. You can select the type of management event that you want to deliver. Valid values:
- All: all read and write events. Auditing-related regulations and standards stipulate that all events must be recorded. We recommend that you select All.
- 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 want to export events only for analysis and focus only on the events that affect cloud resources, select Write.
- Read: the events that record the operations to read information about cloud resources, rather than the operations 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. In most cases, a large number of read events are generated. These events occupy a large amount of storage space. However, auditing-related regulations and standards stipulate that all events must be recorded. 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.
Note By default, when you create a trail in the ActionTrail console, the trail delivers events in all regions. To create a trail that delivers events in specified regions, call the CreateTrail operation. Configure the TrailRegion parameter based on your business requirements when you call this operation.Apply to All Members The application scope of the trail. Valid values: - Yes: If you select this option, the trail delivers the events of the management account and all members in the resource directory to the specified OSS bucket or Log Service Logstore. In this case, a multi-account trail is created. To ensure that all events are delivered, we recommend that you select this option.
- No: If you select this option, the trail delivers only the events of the management account in the resource directory to the specified OSS bucket or Log Service Logstore. In this case, a single-account trail is created.
Note- You cannot modify this parameter after you configure the parameter. If you need to change the value of the Apply Trail to All Member Accounts parameter, delete the multi-account trail and create another one.
- After you create a multi-account trail, Multi-account Trail is displayed in the Trail Type column on the Trails page.
- Event DeliveryYou 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 that are generated after the multi-account trail takes effect are delivered. The events that are 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, configure 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 the current Alibaba Cloud account. - If you select New Log Service Project, you must enter a project name. ActionTrail creates a project with the name that you enter.
- If you select Existing Log Service Project, you must select an existing project from the Project Name drop-down list.
Note After you create a trail to deliver events to Log Service, a Logstore whose name is in theactiontrail_<Trail name>
format is automatically created and optimally configured for subsequent auditing. Indexes and a dashboard are created for the Logstore to facilitate event queries. You cannot manually write data to the Logstore. This ensures data accuracy. You do not need to create a Logstore in advance. - If you select Delivery to Another Account, configure the Log Service Project ARN and RAM Role ARN of Destination Account parameters.
To deliver events to a different 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 members in a resource directory.
- If you select Delivery to Current Account, configure the parameters that are described in the following table.
- Select Delivery to OSS
- If you select Delivery to Current Account, configure 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 current Alibaba Cloud account. - If you select New OSS Bucket, you must enter an OSS bucket name. ActionTrail creates an OSS bucket with the name that you enter.
- If you select Existing OSS Bucket, you must select an existing bucket from the Bucket Name drop-down list.
Important Before you create a bucket in a region within the Chinese mainland, you must complete real-name registration on the Real-name Registration page.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 the log files in the OSS bucket. If you select New OSS Bucket, you must set the parameter. Valid values: - Fully Managed by OSS
- KMS
- No
Note For more information about the server-side encryption feature of OSS, see Server-side encryption. - If you select Delivery to Another Account, configure the RAM Role ARN of OSS Bucket, Bucket Name, and Log File Prefix parameters.
To deliver events to a different 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 members in a resource directory.
- If you select Delivery to Current Account, configure the parameters that are described in the following table.
- Select Delivery to Log Service
- Basic Information
- Click Confirm.
What to do next
After you create a multi-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 by using the management account.
LookupEvents
operation. - Query events that are stored in Log Service: ActionTrail automatically creates a Logstore whose name is in the
actiontrail_<Trail name>
format. On the Trails page, move the pointer over the SLS or SLS & OSS in the Storage Service column and click the name of the Log Service Logstore. - Query events in OSS: Global events that are generated within members are delivered together with the events that are generated in the home region of the trail. Non-global events that are generated for the resources in a specific region are delivered to the corresponding storage paths with the specific region ID. You can analyze the events by using E-MapReduce (EMR) or a third-party log analysis service.
Alternatively, on the Trails page, move the pointer over the OSS or SLS & OSS in the Storage Service column, click the name of the OSS bucket, and then choose . For more information about storage paths in OSS, see What is the storage path of an event that is delivered to an OSS bucket? .