All Products
Search
Document Center

ActionTrail:UpdateTrail

Last Updated:Mar 26, 2026

Updates the configurations of a trail.

Operation description

This topic shows you how to change the destination Object Storage Service (OSS) bucket of a sample trail named trail-test to audit-log.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

actiontrail:UpdateTrail

update

*Trail

acs:actiontrail:{#regionId}:{#accountId}:trail/{#TrailName}

None None

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the trail whose configurations you want to update.

The name must be 6 to 36 characters in length and can contain lowercase letters, digits, hyphens (-), and underscores (_). It must start with a lowercase letter.

Note

The name must be unique within an Alibaba Cloud account.

trail-test

OssBucketName

string

No

The name of the Object Storage Service (OSS) bucket to which you want to deliver events.

The name must be 3 to 63 characters in length. The name must start with a lowercase letter or a digit and can contain lowercase letters, digits, and hyphens (-).

Note

Make sure that the bucket exists before you update the configuration of the trail.

audit-log

OssKeyPrefix

string

No

The prefix of the files that are stored in the OSS bucket.

The prefix must be 6 to 32 characters in length. The prefix must start with a letter and can contain letters, digits, hyphens (-), forward slashes (/), and underscores (_).

at-product-account-audit-B

OssWriteRoleArn

string

No

The Alibaba Cloud Resource Name (ARN) of the RAM role that is assumed by ActionTrail to deliver events to the OSS bucket.

  • If you do not specify this parameter, ActionTrail creates a service-linked role to create the required resources. For more information, see Manage the service-linked role.

  • If you specify this parameter, you must grant the permissions of the service-linked role that is assumed by ActionTrail to the RAM role before you can deliver events to your Alibaba Cloud account. If you need to deliver events to other Alibaba Cloud accounts, you must attach the permission policy that is used to grant permissions related to event delivery to the RAM role. For more information about how to deliver events across Alibaba Cloud accounts, see Deliver events across Alibaba Cloud accounts.

acs:ram::151266687691****:role/aliyunserviceroleforactiontrail

SlsProjectArn

string

No

The ARN of the Log Service project to which you want to deliver events.

acs:log:cn-shanghai:151266687691****:project/test-project

SlsWriteRoleArn

string

No

The ARN of the RAM role that is assumed by ActionTrail to deliver events to the Log Service project.

  • If you do not specify this parameter, ActionTrail creates a service-linked role to create the corresponding resource. For more information, see Manage the service-linked role.

  • If you specify this parameter, you must grant the permissions of the service-linked role that is assumed by ActionTrail to the RAM role before you can deliver events to your Alibaba Cloud account. If you need to deliver events to other Alibaba Cloud accounts, you must attach the permission policy that is used to grant permissions related to event delivery to the RAM role. For more information about how to deliver events across Alibaba Cloud accounts, see Deliver events across Alibaba Cloud accounts.

acs:ram::151266687691****:role/aliyunserviceroleforactiontrail

EventRW

string

No

The read/write type of the events to be delivered. Valid values:

  • Write: write events. It is the default value.

  • Read: read events.

  • All: read and write events.

All

TrailRegion

string

No

The region of the trail.

  • The default value is All, which indicates that the trail delivers events from all regions.

You can also specify specific regions. You can call the DescribeRegions operation to query all the supported regions.

All

MaxComputeProjectArn

string

No

The ARN of the MaxCompute project to which you want to deliver events.

Note

The name of the MaxCompute project must be prefixed with actiontrail_.

acs:odps:cn-hangzhou:、151277687691****:project/actiontrail_****

MaxComputeWriteRoleArn

string

No

The ARN of the role that is assumed by ActionTrail to deliver events to the destination Simple Log Service project.

  • If you do not specify this parameter, ActionTrail creates a service-linked role to create the required resources. For more information, see Manage the service-linked role.

  • If you specify this parameter and deliver events to the current account, you must grant the RAM role the permissions on the service-linked role for ActionTrail. If you want to deliver events to other accounts, you must attach a system policy to the RAM role. For more information about how to deliver events across Alibaba Cloud accounts, see Deliver events across Alibaba Cloud accounts.

acs:ram::151277687691****:role/aliyunserviceroleforactiontrail

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

EventRW

string

The read/write type of the events to be delivered.

Write

HomeRegion

string

The home region of the trail.

cn-hangzhou

MaxComputeProjectArn

string

ARN of the Big Data Compute Service project for tracking delivery.

acs:odps:cn-hangzhou:151266687691****:project/actiontrail_****

MaxComputeWriteRoleArn

string

The ARN of the role that Operation Audit assumes when delivering operation events to the Big Data Compute Service project.

acs:ram::151266687691****:role/aliyunserviceroleforactiontrail

Name

string

The name of the trail.

trail-test

OssBucketName

string

The name of the OSS bucket.

audit-log

OssKeyPrefix

string

The prefix of the log files to be stored in the destination OSS bucket.

at-product-account-audit-B

OssWriteRoleArn

string

The ARN of the RAM role that is assumed by ActionTrail to deliver events to the OSS bucket.

acs:ram::151266687691****:role/aliyunserviceroleforactiontrail

RequestId

string

The ID of the request.

2599A180-5236-44D8-9490-50B6F4F8BA35

SlsProjectArn

string

The ARN of the Log Service project to which events are to be delivered.

acs:log:cn-hangzhou:151266687691****:project/test-project

SlsWriteRoleArn

string

The ARN of the RAM role that is assumed by ActionTrail is to deliver events to the Log Service project.

acs:ram::151266687691****:role/aliyunserviceroleforactiontrail

TrailRegion

string

The one or more regions from which the trail delivers events.

All

Examples

Success response

JSON format

{
  "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": "2599A180-5236-44D8-9490-50B6F4F8BA35",
  "SlsProjectArn": "acs:log:cn-hangzhou:151266687691****:project/test-project",
  "SlsWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
  "TrailRegion": "All"
}

Error codes

HTTP status code

Error code

Error message

Description

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 IncompleteSignature The request signature does not conform to Alibaba Cloud standards. The request signature does not conform to Alibaba Cloud standards.
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. The specified OSS bucket prefix is not valid.
403 InsufficientBucketPolicyException Access to the specified OSS bucket was denied.
403 InsufficientSlsPolicyException Access to the specified Log Service project was denied. Access SLS Project denied.
404 TrailNotFoundException The specified Trail does not exist. The specified Trail is not existed.
404 BucketDoesNotExistException The specified OSS bucket does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.