After you create a trail and specify or create an Object Storage Service (OSS) bucket as the delivery destination for the trail in ActionTrail, events are continuously delivered to and stored in event log files in the OSS bucket. Then, you can use Data Lake Analytics (DLA) to query and analyze the events in a visualized manner.
Prerequisites
- A trail is created and configured to deliver events to a specific OSS bucket. For more information, see Create a single-account trail and Create a multi-account trail.
- DLA is activated. For information about how to activate DLA, see Activate DLA.
Background information
DLA adopts a serverless architecture and is an interactive query and analytics service. DLA allows you to use standard SQL statements to query and analyze log data in different formats and from different sources. For more information, see What is DLA?.
The following steps and figure show how to use DLA to query and analyze the events that are delivered to OSS:
- You create a trail and configure it to deliver events to an OSS bucket by using ActionTrail.
- You synchronize the delivered events from the OSS bucket to DLA.
- OSS stores the log data of multiple events as an array in the OSS bucket. DLA splits the log data by event and stores the log data in the JSON format. Then, DLA converts the log data for each event to a structured table. This simplifies the process of resolving log data in OSS buckets and allows standard SQL queries and analytics of data.

Procedure
- Create a schema in DLA.
- Synchronize events from the OSS bucket to DLA.
- Use standard SQL statements to query and analyze events.
- In the left-side navigation pane, choose .
- Find the database based on which you want to analyze events and double-click the database name.
- Enter the query statement in the SQL editor and click Sync Execute(F8). Then, DLA returns the execution result.
Examples
Query events for a user identified by a specific AccessKey ID
- Query statement:
select * from `action_trail` where `user_identity_access_key_id` = 'User AccessKey ID' limit 20;
- Results: DLA returns the first 20 events that occurred within the user account identified by the specified AccessKey ID.
Query ECS-related events for a user identified by a specific AccessKey ID
- Query statement:
select * from `action_trail` where `user_identity_access_key_id` = 'User AccessKey ID' AND `service_name` = 'Ecs' limit 20;
- Results: DLA returns the first 20 events related to Elastic Compute Service (ECS) that occurred within the user account identified by the specified AccessKey ID.
Schemas
The following table describes the key fields of a schema.
Field | Type | Required | Example | Description |
---|---|---|---|---|
event_id | String | Yes | F23A3DD5-7842-4EF9-9DA1-3776396A**** | The ID of the event. ActionTrail generates a globally unique identifier (GUID) for each event. |
event_name | String | Yes | CreateNetworkInterface | The name of the event.
|
event_source | String | Yes | ecs.aliyuncs.com | The URL of the service that processed the event. |
event_time | String | Yes | 2020-01-09T12:12:14Z | The time when the event occurred, in UTC. |
event_type | String | Yes | ApiCall | The type of the action that was recorded in the event log. Valid values:
|
request_parameters | Dictionary | No | N/A | The parameters specified in the API request. |
response_elements | Dictionary | No | N/A | The response returned for the API request. |
service_name | String | Yes | Ecs | The name of the Alibaba Cloud service with which the event is associated. |
source_ip_address | String | Yes | 11.32.XX.XX | The IP address from which the event occurred.
Note If the API operation involved was called by a user in the Alibaba Cloud Management
Console, this field is set to the IP address of the user, rather than the IP address
of the web server of the Alibaba Cloud Management Console.
|
user_agent | String | Yes | Apache-HttpClient/4.5.7 (Java/1.8.0_152) | The user agent that sent the API request. Examples:
|
user_identity_type | String | Yes | ram-user | The type of the entity that initiated the event. Valid values:
|
user_identity_principal_id | String | Yes | 28815334868278**** | The ID of the requester.
|
user_identity_account_id | String | Yes | 112233445566**** | The ID of the Alibaba Cloud account that owns the requester. |
user_identity_accessKey_id | String | No | 55nCtAwmPLkk**** | The AccessKey ID that is used by the requester. If the requester sent the API request by using an SDK, this field is recorded. If the requester sent the API request by using the Alibaba Cloud Management Console, this field is not recorded. |
user_name | String | No | Alice | The name of the requester. If the user_identity_type field is set to ram-user, this field is set to the name of the RAM user involved. If the user_identity_type field is set to assumed-role, this field is set to a string in the RoleName:RoleSessionName format. |