Creates a Logstore.
Operation description
Usage notes
The Host in the request syntax consists of the project name and the Simple Log Service endpoint. Specify the project in the Host.
Create an AccessKey pair. For more information, see AccessKey pair.
An AccessKey pair for an Alibaba Cloud account has full access to all API operations, which poses a high security risk. We recommend that you create and use a Resource Access Management (RAM) user to call API operations or perform routine O&M. The RAM user must have the permissions to manage Simple Log Service resources. For more information, see Create and authorize a RAM user.
-
Obtain the project name and the region where the project is located. For more information, see Manage projects.
-
Each project can contain a maximum of 200 Logstores.
-
Logs are deleted after the specified data retention period expires.
Authorization
The following table describes the permissions required for this operation. To grant a RAM user or RAM role the permissions to call this operation, add this information to the Action element of a RAM policy.
| Action | Resource description in an authorization policy |
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 requirements:
|
my-logstore |
| shardCount |
integer |
Yes |
The number of shards. Note
You cannot change the number of shards with this operation. To change the number of shards, call the `SplitShard` or `MergeShards` operation. |
2 |
| ttl |
integer |
Yes |
The data retention period, in days. Valid values: 1 to 3650. If you set the value to 3650, data is stored permanently. |
1 |
| encrypt_conf | EncryptConf |
No |
The data structure of the encryption configuration. The parameters include |
|
| autoSplit |
boolean |
No |
Specifies whether to automatically split shards.
|
true |
| enable_tracking |
boolean |
No |
Specifies whether to enable web tracking. Default value: false.
|
false |
| maxSplitShard |
integer |
No |
The maximum number of shards that can be created by an automatic split. The value must be between 1 and 256. Note
This parameter is required if you set the autoSplit parameter to true. |
64 |
| appendMeta |
boolean |
No |
Specifies whether to record the client's public IP address and the log reception time. The default value is false.
|
false |
| telemetryType |
string |
No |
The type of observable data. Valid values:
|
None |
| hot_ttl |
integer |
No |
The retention period of data in the hot storage tier of the Logstore, in days. The minimum value is 7. The value cannot be greater than the value of `ttl`. If you set this parameter to -1, data is permanently stored in the hot tier. After the hot tier retention period expires, data is moved to the Infrequent Access (IA) storage class. For more information, see Automatic Storage Tiering. |
60 |
| mode |
string |
No |
The Logstore mode. Simple Log Service provides two modes: Standard and Query.
|
standard |
| infrequentAccessTTL |
integer |
No |
The retention period of data in the Infrequent Access (IA) storage class, in days. The value must be 30 or greater. |
30 |
| processorId |
string |
No |
The ID of the ingest processor. |
processor-nginx-parser-001 |
| shardingPolicy | ShardingPolicy |
No |
The configuration for hash-based writes. |
|
| resourceGroupId |
string |
No |
The ID of the resource group. |
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.