Queries trails in a region.
This topic provides an example on how to query the single-account trails within the current Alibaba Cloud account. The returned result shows that only one trail named test-4 is created within the Alibaba Cloud account.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
| Action | String | Yes | DescribeTrails | The operation that you want to perform. Set the value to DescribeTrails. |
| IncludeShadowTrails | Boolean | No | true | Specifies whether to return shadow trails. Valid values:
|
| NameList | String | No | audit-log,trail-test2 | The trails to query. Separate the names of multiple trails with commas (,). |
| IncludeOrganizationTrail | Boolean | No | false | Specifies whether to query multi-account trails. Valid values:
|
Response parameters
| Parameter | Type | Example | Description |
| RequestId | String | 10313D41-C40A-4D53-ACA0-0190334DF81C | The ID of the request. |
| TrailList | Array of TrailList | The list of returned trails. |
|
| TrailRegion | String | All | The region in which the trail delivers events. Valid values:
|
| Status | String | Enable | The status of the trail. Valid values:
|
| UpdateTime | String | 1619407012000 | The most recent time when the configuration of the trail was updated. |
| HomeRegion | String | cn-hangzhou | The home region of the trail. |
| CreateTime | String | 1614580048000 | The time when the trail was created. |
| OssKeyPrefix | String | trail1 | The prefix of the log files stored in the Object Storage Service (OSS) bucket. |
| EventRW | String | Write | The type of events to be delivered. Valid values:
|
| StartLoggingTime | String | 1619407012000 | The time when the trail was last enabled. |
| MnsTopicArn | String | acs:mns:cn-hangzhou:1111:/topics/your-topic-name | The Alibaba Cloud Resource Name (ARN) of the Message Service (MNS) topic to which ActionTrail sends messages. The ARN is in the |
| RoleName | String | aliyunactiontraildefaultrole | The name of the Resource Access Management (RAM) role that is assumed by ActionTrail. |
| SlsProjectArn | String | acs:log:cn-hangzhou:159498693826****:project/alice-audit-log | The unique ARN of the Log Service project to which events are delivered. |
| IsOrganizationTrail | Boolean | false | Indicates whether the trail is a multi-account trail. Valid values:
|
| SlsWriteRoleArn | String | acs:ram::159498693826****:role/aliyunserviceroleforactiontrail | The unique ARN of the role that is assumed by ActionTrail to deliver log files to the Log Service project. |
| StopLoggingTime | String | 1617674944000 | The time when the trail was last disabled. |
| Name | String | test-4 | The name of the trail. |
| OssBucketName | String | secloud | The name of the OSS bucket to which events are delivered. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DescribeTrails
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeTrailsResponse>
<RequestId>10313D41-C40A-4D53-ACA0-0190334DF81C</RequestId>
<TrailList>
<Status>Enable</Status>
<MnsTopicArn>acs:mns:cn-hangzhou:1111:/topics/your-topic-name</MnsTopicArn>
<HomeRegion>cn-hangzhou</HomeRegion>
<StartLoggingTime>1619407012000</StartLoggingTime>
<CreateTime>1614580048000</CreateTime>
<StopLoggingTime>1617674944000</StopLoggingTime>
<SlsWriteRoleArn>acs:ram::159498693826****:role/aliyunserviceroleforactiontrail</SlsWriteRoleArn>
<TrailRegion>All</TrailRegion>
<Name>test-4</Name>
<IsOrganizationTrail>false</IsOrganizationTrail>
<SlsProjectArn>acs:log:cn-hangzhou:159498693826****:project/alice-audit-log</SlsProjectArn>
<RoleName>aliyunactiontraildefaultrole</RoleName>
<EventRW>Write</EventRW>
<UpdateTime>1619407012000</UpdateTime>
<OssKeyPrefix>trail1</OssKeyPrefix>
<OssBucketName>secloud</OssBucketName>
</TrailList>
</DescribeTrailsResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "10313D41-C40A-4D53-ACA0-0190334DF81C",
"TrailList" : [ {
"Status" : "Enable",
"MnsTopicArn" : "acs:mns:cn-hangzhou:1111:/topics/your-topic-name",
"HomeRegion" : "cn-hangzhou",
"StartLoggingTime" : 1619407012000,
"CreateTime" : 1614580048000,
"StopLoggingTime" : 1617674944000,
"SlsWriteRoleArn" : "acs:ram::159498693826****:role/aliyunserviceroleforactiontrail",
"TrailRegion" : "All",
"Name" : "test-4",
"IsOrganizationTrail" : false,
"SlsProjectArn" : "acs:log:cn-hangzhou:159498693826****:project/alice-audit-log",
"RoleName" : "aliyunactiontraildefaultrole",
"EventRW" : "Write",
"UpdateTime" : 1619407012000,
"OssKeyPrefix" : "trail1",
"OssBucketName" : "secloud"
} ]
}
Error codes
| HTTP status code | Error code | Error message | Description |
| 400 | InvalidTrailNameException | The specified Trail name is invalid. | The error message returned because the specified trail name is invalid. Specify a valid trail name. |
| 400 | InvalidQueryParameter | The specified query parameter is invalid. | The error message returned because one or more specified request parameters are invalid. |
For a list of error codes, visit the API Error Center.