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.
| 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
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):
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, 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.
|
false |
| telemetryType |
string |
No |
The observable data type. Default value: log data. Valid values:
|
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:
|
60 |
| mode |
string |
No |
Simple Log Service provides two types of Logstores: Standard and Query.
|
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:
|
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.