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.
  • 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.
AutoSplit Boolean No Yes Specifies whether to automatically split shards. Default value: false. Valid values:
  • true: automatically splits shards.
  • false: does not automatically split shards.
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:
  • true: enables web tracking.
  • false: disables web tracking.
PreserveStorage Boolean No Yes Specifies whether to permanently retain logs. Default value: false. Valid values:
  • true: permanently retains logs. The TTL parameter does not take effect if PreserveStorage is set to true.
  • false: does not permanently retain logs.
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:
  • true: automatically adds the public IP address of the client and the log collection time after the log is received.
  • false: does not automatically add the public IP address of the client and the log collection time after the log is received.
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:
  • true: enables data encryption.
  • false: does not enable data encryption.
EncryptType String Yes No The encryption algorithm. Valid values:
  • default: the Advanced Encryption Standard (AES) algorithm.
  • m4: the SM4 encryption algorithm.
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

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test SLS Logstore
    Parameters: {}
    Resources:
      SlsLogStore:
        Type: ALIYUN::SLS::Logstore
        Properties:
          LogstoreName: mytest
          PreserveStorage: true
          ProjectName: TestProject
          AppendMeta: true
          MaxSplitShard: 64
          AutoSplit: true
          EnableTracking: false
          ShardCount: 2
    Outputs: {}
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test SLS Logstore",
      "Parameters": {
      },
      "Resources": {
        "SlsLogStore": {
          "Type": "ALIYUN::SLS::Logstore",
          "Properties": {
            "LogstoreName": "mytest",
            "PreserveStorage": true,
            "ProjectName": "TestProject",
            "AppendMeta": true,
            "MaxSplitShard": 64,
            "AutoSplit": true,
            "EnableTracking": false,
            "ShardCount": 2
          }
        }
      },
      "Outputs": {
      }
    }

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.