CreateLogStore
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. For more information about the format, see API request host description.
-
Create and obtain an AccessKey pair. For more information, see AccessKey pairs.
The AccessKey pair of an Alibaba Cloud account has access permissions to all API operations. Using this AccessKey pair is highly risky. We recommend that you create and use a Resource Access Management (RAM) user to invoke API operations or perform routine O&M. The RAM user must have permissions to perform operations on Simple Log Service resources. For more information, see Create a RAM user and grant permissions.
-
Identify the name and region of the project to which the logs you query belong. For more information about how to query, see Manage projects.
-
You can create up to 200 Logstores in a project.
-
Logs are deleted when the log retention period reaches the data retention period that you specify.
Authorization resources
The following table lists the authorization information for this API operation. You can add this information to the Action element of a RAM policy statement to grant Resource Access Management (RAM) users or RAM roles the permissions to invoke this API operation.
| Action | Resource |
log:CreateLogStore | acs:log:{#regionId}:{#accountId}:project/{#ProjectName}/logstore/{#LogstoreName} |
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
log:CreateLogStore |
create |
*LogStore
|
|
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:
|
my-logstore |
| shardCount |
integer |
Yes |
The number of shards. Note
This operation does not support updating the number of shards. You can modify 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):
Example 2 (Enable BYOK encryption): |
|
| autoSplit |
boolean |
No |
Specifies whether to enable automatic sharding. After this feature is enabled, if the log write traffic continuously exceeds the limit, automatic sharding is triggered to improve the write capacity. When you enable automatic sharding, you must configure the maxSplitShard parameter. |
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 for automatic sharding. 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.
|
false |
| telemetryType |
string |
No |
The observable data type. Default value: log data. Valid values:
|
None |
| hot_ttl |
integer |
No |
The retention period 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 time of data exceeds the configured hot data retention period, the data is transitioned to the infrequent access (IA) tier. When you enable the IA tier, the hot data retention period must be at least 7 days. For more information, see Intelligent tiering. Examples:
|
60 |
| mode |
string |
No |
Simple Log Service provides two types of Logstores: Standard and Query.
|
standard |
| infrequentAccessTTL |
integer |
No |
The IA tier. No minimum retention period is required, but data must be retained for at least 30 days before being transitioned to the archive tier. When the log retention period is greater than the sum of the hot tier retention period and the IA tier retention period, the remaining retention period is applied to the archive tier. Examples:
|
30 |
| processorId |
string |
No |
The ID of the write processor. |
processor-nginx-parser-001 |
| shardingPolicy | ShardingPolicy |
No |
The hash write configuration. When data is written, logs are routed to shards based on the configured hash policy. Before configuration, ensure that the hash ranges of the shards are even. This may affect the write capacity, so configure it 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 log modification and deletion. |
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.