Creates a Logstore.

Request headers

This operation uses only common request headers. For more information, see Common request headers.

Request syntax

POST /logstores HTTP/1.1

Request parameters

Parameter Type Location Required Example Description
project String Host Yes ali-test-project
The name of the project. The name must meet the following rules:
  • The name must be unique in a project.
  • The name can contain only lowercase letters, digits, and hyphens (-).
  • The name must start and end with a lowercase letter or digit.
  • The name must be 3 to 63 characters in length.
appendMeta Boolean FormData No false

Specifies whether to record public IP addresses. Default value: false. Valid values:

  • true: records public IP addresses
  • false: does not record public IP addresses
autoSplit Boolean FormData No true

Specifies whether to enable automatic sharding. Default value: false. Valid values:

  • true: enables automatic sharding
  • false: disables automatic sharding
enable_tracking Boolean FormData No false

Specifies whether to enable the WebTracking feature. Default value: false. Valid values:

  • true: enables the WebTracking feature
  • false: disables the WebTracking feature
logstoreName String FormData No my-logstore
The name of the Logstore. The name must meet the following requirements:
  • The name must be unique in a project.
  • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
  • The name must start and end with a lowercase letter or digit.
  • The name must be 3 to 63 characters in length.
maxSplitShard Integer FormData No 64

The maximum number of shards into which a shard can be automatically split. Valid values: 1 to 64.

Note If you set the autoSplit parameter to true, you must specify the maxSplitShard parameter.
shardCount Integer FormData No 2

The number of shards.

Note You cannot call the CreateLogstore operation to change the number of shards. You can call the SplitShard or MergeShards operation to change the number of shards.
ttl Integer FormData No 1

The maximum retention period of data. Unit: days. Valid values: 1 to 3000. If you set the value to 3650, data is permanently stored.

encrypt_conf EncryptConf FormData No

The data encryption configurations.

Response parameters

Parameter Type Example Description
Server String nginx

The name of the server.

Content-Length String 0

The length of the content.

Connection String close

Indicates whether the connection is persistent.

Access-Control-Allow-Origin String *

Indicates whether code from any origin is allowed to access the resource.

Date String Sun, 27 May 2018 08:25:04 GMT

The date.

x-log-requestid String 5B0A6B60BB6EE39764D458B5

The ID of the request.

Examples

Sample requests

POST /logstores HTTP/1.1
Host:ali-test-project.cn-hangzhou.log.aliyuncs.com
Content-Type:application/json

appendMeta=false&autoSplit=true&enable_tracking=false&logstoreName=my-logstore&maxSplitShard=64&shardCount=2&ttl=1&encrypt_conf={"user_cmk_info":{}}

Sample success responses

JSON format

HTTP/1.1 200 OK

Error codes

For a list of error codes, visit the API Error Center.