Creates a Logstore in a project.
Request syntax
POST /logstores HTTP/1.1
Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1
{
"logstoreName" : <logStoreName>,
"ttl": <ttl>,
"shardCount": <shardCount>,
"autoSplit": <autoSplit>,
"maxSplitShard": <maxSplitShard>
}
Request parameters
- Request headers
The CreateLogstore operation does not have operation-specific request headers. For information about the common request headers of Log Service API operations, see Common request headers.
- Parameters
Parameter Type Required Example Description logstoreName string Yes test-logstore The name of the Logstore. The name must be unique in a project. ttl integer Yes 1 The retention period of data. Unit: days. Valid values: 1 to 3600. shardCount integer Yes 2 The number of shards. Valid values: 1 to 100. enable_tracking bool No None. Specifies whether to enable the WebTracking feature. Default value: false. autoSplit bool No ture Specifies whether to enable automatic sharding. Default value: false. maxSplitShard int No 6 The maximum number of shards for automatic sharding. Valid values: 1 to 64. Default value: 64. This parameter must be specified if the autoSplit parameter is set to true.
Response parameters
- Response headers
The CreateLogstore operation does not have operation-specific response headers. For information about the common response headers of Log Service API operations, see Common response headers.
- Response elements
The HTTP status code 200 is returned.
Examples
- Sample requests
POST /logstores HTTP/1.1 Header : { x-log-apiversion=0.6.0, Authorization=LOG <yourAccessKeyId>:<yourSignature>, Host=ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com, Date=Wed, 11 Nov 2015 07:35:00 GMT, Content-Length=55, x-log-signaturemethod=hmac-sha1, Content-MD5=7EF43D0B8F4A807B95E775048C911C72, User-Agent=sls-java-sdk-v-0.6.0, Content-Type=application/json } Body : { "logstoreName": "test-logstore", "ttl": 1, "shardCount": 2, "autoSplit": true, "maxSplitShard": 64 }
- Sample responses
HTTP/1.1 200 OK Header: { Date=Wed, 11 Nov 2015 07:35:00 GMT, Content-Length=0, x-log-requestid=5642EFA499248C827B012B39, Connection=close, Server=nginx/1.6.1 }
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | LogstoreAlreadyExist | logstore {logstoreName} already exists. | The error message returned because the specified Logstore already exists. |
500 | InternalServerError | Specified Server Error Message. | The error message returned because an internal server error has occurred. |
400 | LogstoreInfoInvalid | logstore info is invalid. | The error message returned because the Logstore information is invalid. |
400 | ProjectQuotaExceed | Project Quota Exceed. | The error message returned because the project quota has exceeded the limit. |
For more information about the error codes, see Common error codes.