ALIYUN::SLS::Logstore is used to create a Logstore in a Log Service project.
Syntax
{
"Type": "ALIYUN::SLS::Logstore",
"Properties": {
"ProjectName": String,
"ShardCount": Integer,
"AutoSplit": Boolean,
"MaxSplitShard": Integer,
"LogstoreName": String,
"AppendMeta": Boolean,
"TTL": Integer,
"EnableTracking": Boolean,
"PreserveStorage": Boolean,
"EncryptConf": Map
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ProjectName | String | Yes | No | The name of the Log Service project that the Logstore belongs to. |
The name must be 3 to 36 characters in length. The name can contain lowercase letters, digits, hyphens (-), and underscores (_). The name must start and end with a lowercase letter or digit. |
ShardCount | Integer | No | Yes | The number of shards. |
Valid values: 1 to 100. Default value: 2. |
MaxSplitShard | Integer | No | Yes | The maximum number of shards that can be obtained during automatic splitting. | Valid values: 1 to 64.
MaxSplitShard is required if autoSplit is set to true. |
LogstoreName | String | Yes | No | The name of the Logstore. | The name must be unique in a project.
|
AutoSplit | Boolean | No | Yes | Specifies whether to automatically split shards. | Default value: false. Valid values:
|
TTL | Integer | No | Yes | The data retention period. | Valid values: 1 to 3600.
Default value: 30. Unit: days. |
EnableTracking | Boolean | No | Yes | Specifies whether to enable web tracking. |
You can use web tracking to collect access information about web browsers, iOS applications, and Android applications. Default value: false. Valid values:
|
PreserveStorage | Boolean | No | Yes | Specifies whether to permanently retain logs. | Default value: false. Valid values:
|
AppendMeta | Boolean | No | Yes | Specifies whether to automatically add the public IP address of the client and the log arrival time after the log is received. | Default value: false. Valid values:
|
EncryptConf | Map | No | No | The data encryption configurations. |
For more information, see EncryptConf syntax and EncryptConf properties. |
EncryptConf syntax
"EncryptConf": {
"Enable": Boolean,
"EncryptType": String,
"UserCmkInfo": Map
}
EncryptConf properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Enable | Boolean | Yes | No | Specifies whether to enable data encryption. | Default value: false. Valid values:
|
EncryptType | String | Yes | No | The encryption algorithm. | Valid values:
Note For more information about data encryption, see Encrypt data.
|
UserCmkInfo | Map | No | No | We recommend that you use the bring-your-own-key (BYOK) method to encrypt or decrypt data if UserCmkInfo is specified. If UserCmkInfo is not specified, the service key of Log Service is used to encrypt or decrypt data. |
For more information, see UserCmkInfo syntax and UserCmkInfo properties. |
UserCmkInfo syntax
"UserCmkInfo": {
"CmkKeyId": String,
"Arn": String,
"RegionId": String
}
UserCmkInfo properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
CmkKeyId | String | Yes | No | The ID of the customer master key (CMK) to which the BYOK key belongs. | None |
Arn | String | Yes | No | The ID of the region to which the CMK belongs. | None |
RegionId | String | Yes | No | The Alibaba Cloud Resource Name (ARN) of the RAM role. | For more information about how to obtain the ARN of a RAM role, see Ship log data from Log Service to OSS. |
Response parameters
Fn::GetAtt
LogstoreName: the name of the Logstore.
Examples
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"LogstoreName": {
"Type": "String",
"Description": "Logstore name:\n1. Only supports lowercase letters, numbers, hyphens (-) and underscores (_).\n2. Must start and end with lowercase letters and numbers.\n3. The name length is 3-63 characters.",
"MinLength": 3,
"MaxLength": 63
},
"PreserveStorage": {
"Type": "Boolean",
"Description": "Whether to keep the log permanently.\nIf set to true, TTL will be ignored.\nDefault to false.",
"AllowedValues": [
"True",
"true",
"False",
"false"
],
"Default": false
},
"ProjectName": {
"Type": "String",
"Description": "Project name:\n1. Only supports lowercase letters, numbers, hyphens (-) and underscores (_).\n2. Must start and end with lowercase letters and numbers.\n3. The name length is 3-63 characters.",
"AllowedPattern": "^[a-zA-Z0-9_-]+$",
"MinLength": 3,
"MaxLength": 63
},
"AppendMeta": {
"Type": "Boolean",
"Description": "Whether to add client external network IP and log arrival time after receiving the log.\nDefault to false.",
"AllowedValues": [
"True",
"true",
"False",
"false"
],
"Default": false
},
"MaxSplitShard": {
"Type": "Number",
"Description": "The maximum number of shards when splitting automatically. Must be specified if AutoSplit is set to true.\nAllowed Values: 1-64.",
"MinValue": 1,
"MaxValue": 64
},
"AutoSplit": {
"Type": "Boolean",
"Description": "Whether to automatically split the shard.\nDefault to false.",
"AllowedValues": [
"True",
"true",
"False",
"false"
],
"Default": false
},
"EnableTracking": {
"Type": "Boolean",
"Description": "Whether to enable WebTracking, which supports fast capture of various browsers and iOS/Android/APP access information.\nDefault to false.",
"AllowedValues": [
"True",
"true",
"False",
"false"
],
"Default": false
},
"EncryptConf": {
"Type": "Json",
"Description": "Data encryption config"
},
"TTL": {
"Type": "Number",
"Description": "The lifecycle of log in the logstore in days.\nAllowed Values: 1-3600, default to 30.",
"MinValue": 1,
"MaxValue": 3600,
"Default": 30
},
"ShardCount": {
"Type": "Number",
"Description": "The number of Shards.\nAllowed Values: 1-100, default to 2.",
"MinValue": 1,
"MaxValue": 100,
"Default": 2
}
},
"Resources": {
"Logstore": {
"Type": "ALIYUN::SLS::Logstore",
"Properties": {
"LogstoreName": {
"Ref": "LogstoreName"
},
"PreserveStorage": {
"Ref": "PreserveStorage"
},
"ProjectName": {
"Ref": "ProjectName"
},
"AppendMeta": {
"Ref": "AppendMeta"
},
"MaxSplitShard": {
"Ref": "MaxSplitShard"
},
"AutoSplit": {
"Ref": "AutoSplit"
},
"EnableTracking": {
"Ref": "EnableTracking"
},
"EncryptConf": {
"Ref": "EncryptConf"
},
"TTL": {
"Ref": "TTL"
},
"ShardCount": {
"Ref": "ShardCount"
}
}
}
},
"Outputs": {
"LogstoreName": {
"Description": "Logstore name.",
"Value": {
"Fn::GetAtt": [
"Logstore",
"LogstoreName"
]
}
}
}
}
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
AppendMeta:
AllowedValues:
- 'True'
- 'true'
- 'False'
- 'false'
Default: false
Description: 'Whether to add client external network IP and log arrival time after
receiving the log.
Default to false.'
Type: Boolean
AutoSplit:
AllowedValues:
- 'True'
- 'true'
- 'False'
- 'false'
Default: false
Description: 'Whether to automatically split the shard.
Default to false.'
Type: Boolean
EnableTracking:
AllowedValues:
- 'True'
- 'true'
- 'False'
- 'false'
Default: false
Description: 'Whether to enable WebTracking, which supports fast capture of various
browsers and iOS/Android/APP access information.
Default to false.'
Type: Boolean
EncryptConf:
Description: Data encryption config
Type: Json
LogstoreName:
Description: 'Logstore name:
1. Only supports lowercase letters, numbers, hyphens (-) and underscores (_).
2. Must start and end with lowercase letters and numbers.
3. The name length is 3-63 characters.'
MaxLength: 63
MinLength: 3
Type: String
MaxSplitShard:
Description: 'The maximum number of shards when splitting automatically. Must
be specified if AutoSplit is set to true.
Allowed Values: 1-64.'
MaxValue: 64
MinValue: 1
Type: Number
PreserveStorage:
AllowedValues:
- 'True'
- 'true'
- 'False'
- 'false'
Default: false
Description: 'Whether to keep the log permanently.
If set to true, TTL will be ignored.
Default to false.'
Type: Boolean
ProjectName:
AllowedPattern: ^[a-zA-Z0-9_-]+$
Description: 'Project name:
1. Only supports lowercase letters, numbers, hyphens (-) and underscores (_).
2. Must start and end with lowercase letters and numbers.
3. The name length is 3-63 characters.'
MaxLength: 63
MinLength: 3
Type: String
ShardCount:
Default: 2
Description: 'The number of Shards.
Allowed Values: 1-100, default to 2.'
MaxValue: 100
MinValue: 1
Type: Number
TTL:
Default: 30
Description: 'The lifecycle of log in the logstore in days.
Allowed Values: 1-3600, default to 30.'
MaxValue: 3600
MinValue: 1
Type: Number
Resources:
Logstore:
Properties:
AppendMeta:
Ref: AppendMeta
AutoSplit:
Ref: AutoSplit
EnableTracking:
Ref: EnableTracking
EncryptConf:
Ref: EncryptConf
LogstoreName:
Ref: LogstoreName
MaxSplitShard:
Ref: MaxSplitShard
PreserveStorage:
Ref: PreserveStorage
ProjectName:
Ref: ProjectName
ShardCount:
Ref: ShardCount
TTL:
Ref: TTL
Type: ALIYUN::SLS::Logstore
Outputs:
LogstoreName:
Description: Logstore name.
Value:
Fn::GetAtt:
- Logstore
- LogstoreName
To view more examples, visit SLS.json and SLS.yml. In the examples, the ALIYUN::SLS::Project, ALIYUN::SLS::Logstore, ALIYUN::SLS::Index, ALIYUN::SLS::LogtailConfig, ALIYUN::SLS::MachineGroup, ALIYUN::SLS::ApplyConfigToMachineGroup, ALIYUN::ApiGateway::LogConfig, ALIYUN::SLS::Savedsearch, and ALIYUN::SLS::Alert resource types are used.