イベントを Simple Log Service (SLS) または Object Storage Service (OSS) に配信する証跡を作成します。
構文
{
"Type": "ALIYUN::ACTIONTRAIL::Trail",
"Properties": {
"Name": String,
"OssBucketName": String,
"RoleName": String,
"OssKeyPrefix": String,
"EventRW": String,
"SlsProjectArn": String,
"SlsWriteRoleArn": String
}
}
プロパティ
|
プロパティ名 |
タイプ |
必須 |
更新許可 |
説明 |
制約 |
|
Name |
String |
Yes |
No |
証跡の名前。 |
名前は 6~36 文字です。先頭は英字で、英字、数字、ハイフン (-)、アンダースコア (_) が使用できます。 説明
証跡名は Alibaba Cloud アカウント内で一意である必要があります。 |
|
EventRW |
String |
No |
Yes |
配信するイベントの読み取り/書き込みタイプ。 |
有効な値:
|
|
OssBucketName |
String |
No |
Yes |
証跡がイベントを配信する OSS バケットの名前。 |
名前は 3~63 文字です。先頭は小文字の英字または数字で、小文字の英字、数字、ハイフン (-) が使用できます。 説明
|
|
OssKeyPrefix |
String |
No |
Yes |
OSS バケットに保存されるログファイルのプレフィックス。 |
値は英字で始まり、長さは 6~32 文字です。英字、数字、ハイフン (-)、スラッシュ (/)、アンダースコア (_) が使用できます。 |
|
RoleName |
String |
No |
Yes |
ActionTrail のサービスリンクロールの名前。 |
デフォルト値:AliyunServiceRoleForActionTrail。 |
|
SlsProjectArn |
String |
No |
Yes |
証跡がイベントを配信する SLS プロジェクトの Alibaba Cloud リソースネーム (ARN)。 |
SLS プロジェクトと Logstore が作成済みであることを確認してください。Logstore の名前は 詳細については、「プロジェクトの作成」および「標準 Logstore の作成」をご参照ください。 説明
OssBucketName または SlsProjectArn のいずれか 1 つ以上を指定してください。 |
|
SlsWriteRoleArn |
String |
No |
Yes |
管理イベントを SLS プロジェクトに配信するために ActionTrail が引き受けるロールの ARN。 |
なし |
戻り値
Fn::GetAtt
Name:証跡の名前。
例
YAML フォーマット
ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
Role:
Type: ALIYUN::RAM::Role
Properties:
RoleName: TestRole
Policies:
- PolicyName:
Fn::Sub: ActionTrailPolicy-${ALIYUN::StackId}
PolicyDocument:
Version: '1'
Statement:
- Action:
- oss:GetBucketLocation
- oss:ListObjects
- oss:PutObject
Resource:
- '*'
Effect: Allow
- Action:
- log:PostLogStoreLogs
- log:CreateLogstore
- log:GetLogstore
Resource:
- '*'
Effect: Allow
- Action:
- mns:PublishMessage
Resource:
- '*'
Effect: Allow
AssumeRolePolicyDocument:
Version: '1'
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- actiontrail.aliyuncs.com
Bucket:
Type: ALIYUN::OSS::Bucket
Properties:
AccessControl: private
BucketName: MyTestBucket
DeletionForce: true
SlsProject:
Type: ALIYUN::SLS::Project
Properties:
Name: DemoSls
SlsLogStore:
Type: ALIYUN::SLS::Logstore
DependsOn: SlsProject
Properties:
LogstoreName: actiontrail_TestTrail
PreserveStorage: true
ProjectName:
Fn::GetAtt:
- SlsProject
- Name
AppendMeta: true
MaxSplitShard: 64
AutoSplit: true
EnableTracking: false
ShardCount: 2
Trail:
DependsOn:
- Role
- Bucket
- SlsLogStore
Type: ALIYUN::ACTIONTRAIL::Trail
Properties:
SlsProjectArn:
Fn::Sub: acs:log:${ALIYUN::Region}::project/DemoSls
RoleName:
Fn::GetAtt:
- Role
- RoleName
EventRW: All
OssKeyPrefix: TestFile
OssBucketName:
Fn::GetAtt:
- Bucket
- Name
SlsWriteRoleArn:
Fn::Sub: acs:ram::${ALIYUN::TenantId}:role/${Role.RoleName}
Name: TestTrail
TrailLogging:
Type: ALIYUN::ACTIONTRAIL::TrailLogging
Properties:
Name:
Fn::GetAtt:
- Trail
- Name
Enable: true
Outputs:
Name:
Value:
Fn::GetAtt:
- Trail
- Name
JSON フォーマット
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {},
"Resources": {
"Role": {
"Type": "ALIYUN::RAM::Role",
"Properties": {
"RoleName": "TestRole",
"Policies": [
{
"PolicyName": {
"Fn::Sub": "ActionTrailPolicy-${ALIYUN::StackId}"
},
"PolicyDocument": {
"Version": "1",
"Statement": [
{
"Action": [
"oss:GetBucketLocation",
"oss:ListObjects",
"oss:PutObject"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"log:PostLogStoreLogs",
"log:CreateLogstore",
"log:GetLogstore"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"mns:PublishMessage"
],
"Resource": [
"*"
],
"Effect": "Allow"
}
]
}
}
],
"AssumeRolePolicyDocument": {
"Version": "1",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"actiontrail.aliyuncs.com"
]
}
}
]
}
}
},
"Bucket": {
"Type": "ALIYUN::OSS::Bucket",
"Properties": {
"AccessControl": "private",
"BucketName": "MyTestBucket",
"DeletionForce": true
}
},
"SlsProject": {
"Type": "ALIYUN::SLS::Project",
"Properties": {
"Name": "DemoSls"
}
},
"SlsLogStore": {
"Type": "ALIYUN::SLS::Logstore",
"DependsOn": "SlsProject",
"Properties": {
"LogstoreName": "actiontrail_TestTrail",
"PreserveStorage": true,
"ProjectName": {
"Fn::GetAtt": [
"SlsProject",
"Name"
]
},
"AppendMeta": true,
"MaxSplitShard": 64,
"AutoSplit": true,
"EnableTracking": false,
"ShardCount": 2
}
},
"Trail": {
"DependsOn": [
"Role",
"Bucket",
"SlsLogStore"
],
"Type": "ALIYUN::ACTIONTRAIL::Trail",
"Properties": {
"SlsProjectArn": {
"Fn::Sub": "acs:log:${ALIYUN::Region}::project/DemoSls"
},
"RoleName": {
"Fn::GetAtt": [
"Role",
"RoleName"
]
},
"EventRW": "All",
"OssKeyPrefix": "TestFile",
"OssBucketName": {
"Fn::GetAtt": [
"Bucket",
"Name"
]
},
"SlsWriteRoleArn": {
"Fn::Sub": "acs:ram::${ALIYUN::TenantId}:role/${Role.RoleName}"
},
"Name": "TestTrail"
}
},
"TrailLogging": {
"Type": "ALIYUN::ACTIONTRAIL::TrailLogging",
"Properties": {
"Name": {
"Fn::GetAtt": [
"Trail",
"Name"
]
},
"Enable": true
}
}
},
"Outputs": {
"Name": {
"Value": {
"Fn::GetAtt": [
"Trail",
"Name"
]
}
}
}
}