All Products
Search
Document Center

Simple Log Service:CreateLogStore

Last Updated:Oct 20, 2026

Creates a Logstore.

Operation description

Operation description

  • The Host in the request syntax consists of the project name and the Simple Log Service endpoint. You must specify the project in the Host.

  • An AccessKey pair is created and obtained. For more information, see AccessKey pairs.

    The AccessKey pair of an Alibaba Cloud account has access permissions to all API operations. Using the AccessKey pair of an Alibaba Cloud account to perform operations is highly risky. Create and use a RAM user to call API operations or perform routine O&M. The RAM user must have permissions to manage Simple Log Service resources. For more information, see Create a RAM user and grant permissions to the RAM user.

  • You have identified the name and region of the project to which the logs you want to query belong. For more information, see Manage a project.

  • You can create up to 200 Logstores in a project.

  • Logs are deleted when the data retention period expires.

Authentication resources

The following table lists the authorization information of the API operation. You can add the information to the Action element of a RAM policy statement to grant a RAM user or RAM role the permissions to call this API operation.

ActionResource
log:CreateLogStoreacs:log:{#regionId}:{#accountId}:project/{#ProjectName}/logstore/{#LogstoreName}

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

log:CreateLogStore

create

*LogStore

acs:log:{#regionId}:{#accountId}:project/{#project}/logstore/{#logstoreName}

  • log:TLSVersion
  • log:Encrypted
None

Request syntax

POST /logstores HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

project

string

Yes

The name of the project.

ali-test-project

body

object

Yes

The request parameters.

logstoreName

string

Yes

The name of the Logstore. The name must meet the following rules:

  • The name must be unique in the project.

  • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).

  • The name must start and end with a lowercase letter or a digit.

  • The name must be 2 to 63 characters in length.

my-logstore

shardCount

integer

Yes

The number of shards.

Note

You cannot use this API operation to update the number of shards. You can change the number of shards only by calling the SplitShard or MergeShards operation.

2

ttl

integer

Yes

The data retention period. Unit: days. Valid values: 1 to 3650. A value of 3650 indicates permanent retention.

1

encrypt_conf EncryptConf

No

The encryption configuration structure, which includes the enable, encrypt_type, and user_cmk_info parameters. For more information, see EncryptConf.

Example 1 (Enable default encryption configuration):

{
    "enable": true,
    "encrypt_conf": "default"
}

Example 2 (Enable BYOK encryption):

{
    "enable": true,
    "encrypt_conf": "default",
    "user_cmk_info": {
        "cmk_key_id": "xxxxx",
        "arn": "acs:ram::112340000000:role/rolename",
        "region": "cn-hangzhou"
    }
}

autoSplit

boolean

No

Specifies whether to enable automatic sharding. After this feature is enabled, if the log write traffic continuously exceeds the limit, shards are automatically split to improve the write capability. When you enable automatic sharding, you must configure the maxSplitShard parameter to specify the maximum number of shards.

true

enable_tracking

boolean

No

Specifies whether to enable the WebTracking feature. Default value: false. You can use the WebTracking feature to collect and analyze user behavior data in browsers or mini programs, such as page views, purchase records, and time on site.

false

maxSplitShard

integer

No

The maximum number of shards that can be automatically split. Minimum value: 1. Maximum value: 256.

Note

This parameter is required when the autoSplit parameter is set to true.

64

appendMeta

boolean

No

Specifies whether to record the public IP address and log receiving time. Default value: false.

  • true: enables the feature to record the public IP address and log receiving time. After this feature is enabled, Simple Log Service automatically adds the public IP address of the device from which the logs are generated and the time when the logs arrive at the server to the tag field of the logs.

  • false: disables the feature to record the public IP address and log receiving time.

false

telemetryType

string

No

The observable data type. Default value: log data. Valid values:

  • None: log data. This is the default value.

  • Metrics: time series data.

None

hot_ttl

integer

No

The storage duration of data in the hot tier of the Logstore. Unit: days. Minimum value: 7. The maximum value cannot exceed the value of the ttl parameter. By default, all data is stored in the hot tier within the ttl period.

When the storage duration of data exceeds the specified data retention period in the hot tier, the data is transferred to the infrequent access (IA) tier. When you enable the IA tier, the hot storage duration must be at least 7 days. For more information, see Intelligent tiering.

Examples:

  • Scenario 1 (Enable only hot storage for 30 days): {"ttl": 30} or {"ttl": 30, "hot_ttl": 30}

  • Scenario 2 (Enable hot storage for 7 days and IA storage for 23 days): {"ttl": 30, "hot_ttl": 7}

60

mode

string

No

Simple Log Service provides two types of Logstores: Standard and Query.

  • standard: supports the all-in-one data analytics feature of Simple Log Service. It is suitable for scenarios such as real-time monitoring, interactive analysis, and building a complete observability system.

  • query: supports high-performance queries. The index traffic fee is about half of that of the Standard type, but SQL analysis is not supported. It is suitable for scenarios with a large data volume, long storage period (weeks or months), and no log analysis.

standard

infrequentAccessTTL

integer

No

The storage duration in the IA tier. No minimum storage duration is required. Data is transferred to the archive tier after being stored in the IA tier for at least 30 days.

When the log storage duration exceeds the sum of the hot storage duration and the IA storage duration, the remaining storage duration is converted to archive storage.

Examples:

  • Scenario 1 (Enable hot storage for 7 days and IA storage for 23 days): {"ttl": 30, "hot_ttl": 7}

  • Scenario 2 (Enable hot storage for 7 days, IA storage for 30 days, and archive storage for 60 days): {"ttl": 97, "hot_ttl": 7, "infrequentAccessTTL": 30}

  • Scenario 3 (Enable hot storage for 60 days, IA storage for 0 days, and archive storage for 60 days): {"ttl": 120, "hot_ttl": 60, "infrequentAccessTTL": 0}

30

processorId

string

No

IngestProcessor ID

processor-nginx-parser-001

shardingPolicy ShardingPolicy

No

The hash-based write configuration. When data is written, logs are stored in shards based on the configured hash policy. Before configuration, ensure that the hash ranges of the shards are even. This configuration may affect the write capability. Proceed with caution.

resourceGroupId

string

No

The ID of the resource group. After you specify this parameter, the Logstore is associated with the resource group.

rg-xxxxxxxx

enableModify

boolean

No

Specifies whether to enable the log modification and deletion feature.

Response elements

Element

Type

Description

Example

None defined.

Examples

Success response

JSON format

{}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.