edit-icon download-icon

CreateTrail

Last Updated: Mar 26, 2018

Description

Creates a trail that specifies the settings for delivery of log data to an OSS bucket.

Request parameters

Name Type Required Description
Action String Yes The parameter of the operation to perform:
CreateTrail.
Name String Yes The name of the trail to create.
A user cannot have 2 trails with the same name.
OssBucketName String Yes The OSS bucket to which the trail delivers the logs.
Make sure that this is an existed OSS bucket.
RoleName String Yes The RAM role of the ActionTrail service
permitted by the user.
OssKeyPrefix String No The prefix of the specified OSS bucket name.
This is not required.

Response parameters

Common response parameters. For more information, see Common parameters.

Name Type Description
Name String The trail name.
HomeRegion String The home region of the trail.
OssBucketName String The specified OSS bucket.
OssKeyPrefix String The Prefix of the OSS bucket name.
RoleName String The RAM role.

Required permissions

Action

actiontrail:CreateTrail

Resource

acs:actiontrail:${region}:${AccountId}:*

Error codes

Error code Description HTTP status code
InvalidBucketNameException Invalid bucket name. 400
InvalidPrefixException Invalid prefix. 400
InvalidTrailNameException Invalid trail name. 400
TrailAlreadyExistsException The specified name already exists, or a trail already exists in the region. 400
InsufficientBucketPolicyException No permission to access the specified OSS bucket. 403
MaximumNumberOfTrailsExceededException The maximum number of trails that a user can create in a region is exceeded. 403
BucketDoesNotExistException The specified bucket does not exist. 404

Example

Request example

  1. http://actiontrail.cn-hangzhou.aliyuncs.com/actiontrail?
  2. &OssBucketName=yuanchuang
  3. &Name=trail-test
  4. &RoleName=aliyunactiontraildefaultrole
  5. &Action=CreateTrail
  6. &OssKeyPrefix=
  7. &<公共请求参数>

Response example

JSON example

  1. {
  2. "Name": "trail-test",
  3. "OssBucketName": "yuanchuang",
  4. "OssKeyPrefix": "",
  5. "RoleName": "aliyunactiontraildefaultrole"
  6. }
Thank you! We've received your feedback.