CreateLogstore

Last Updated: Apr 19, 2017

Creates a logstore for the project.

Example:

POST /logstores

Request syntax

  1. POST /logstores HTTP/1.1
  2. Authorization: <AuthorizationString>
  3. Date: <GMT Date>
  4. Host: <Project Endpoint>
  5. x-log-apiversion: 0.6.0
  6. x-log-signaturemethod: hmac-sha1
  7. {
  8. "logstoreName" : <logStoreName>,
  9. "ttl": <ttl>,
  10. "shardCount": <shardCount>
  11. }

Request parameters

Attribute Name Type Required or Not Description
logstoreName string Yes The logstore name, which must be unique in the project.
ttl integer Yes The data retention period (days).
shardCount integer Yes The shard count for this logstore.

Request header

The CreateLogstore interface does not have a specific request header. For details about public request headers of Log Service APIs, refer to Public Request Headers.

Response header

The CreateLogstore interface does not have a specific response header. For details about public response headers of Log Service APIs, refer to Public Response Headers.

Response element

The system returns the HTTP status code 200.

Error code

The CreateLogstore interface may return the following specific error codes in addition to Log Service API Common Error Codes:

HTTP Status Code Error Code Error Message
400 LogstoreAlreadyExist logstore {logstoreName} already exist
500 InternalServerError Specified Server Error Message
400 LogstoreInfoInvalid logstore info is invalid
400 ProjectQuotaExceed Project Quota Exceed

Detailed description

The logstore cannot be created if quota is invalid.

Example

Request example:
  1. POST /logstores HTTP/1.1
  2. Header :
  3. {
  4. x-log-apiversion=0.6.0,
  5. Authorization=LOG 94to3z418yupi6ikawqqd370:8IwDTWugRK1AZAo0dWQYpffhy48=,
  6. Host=ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com,
  7. Date=Wed, 11 Nov 2015 07:35:00 GMT,
  8. Content-Length=55,
  9. x-log-signaturemethod=hmac-sha1,
  10. Content-MD5=7EF43D0B8F4A807B95E775048C911C72,
  11. User-Agent=sls-java-sdk-v-0.6.0,
  12. Content-Type=application/json
  13. }
  14. Body :
  15. {
  16. "logstoreName": "test-logstore",
  17. "ttl": 1,
  18. "shardCount": 2
  19. }
Response example:
  1. HTTP/1.1 200 OK
  2. Header:
  3. {
  4. Date=Wed, 11 Nov 2015 07:35:00 GMT,
  5. Content-Length=0,
  6. x-log-requestid=5642EFA499248C827B012B39,
  7. Connection=close,
  8. Server=nginx/1.6.1
  9. }
Thank you! We've received your feedback.