调用CreateLogStore创建Logstore。
接口说明
请求语法中Host由Project名称和日志服务Endpoint构成,您需要在Host中指定Project。
请求头
该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。
请求语法
POST /logstores HTTP/1.1
请求参数
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|---|
project | String | Host | 是 | ali-test-project |
Project名称在阿里云地域内全局唯一,创建后不可修改。其命名规则如下:
|
Object | Body | 是 |
请求参数。 |
||
logstoreName | String | Body | 是 | my-logstore |
Logstore名称。其命名规则如下:
|
shardCount | Integer | Body | 是 | 2 |
Shard分区个数。 说明 该接口不支持更新Shard个数。只能通过SplitShard或MergeShards接口修改Shard个数。
|
ttl | Integer | Body | 是 | 1 |
数据的保存时间,单位为天。取值范围为1~3000。如果配置为3650,表示永久保存。 |
encrypt_conf | EncryptConf | Body | 否 |
加密配置数据结构。 |
|
autoSplit | Boolean | Body | 否 | true |
是否自动分裂Shard。
|
enable_tracking | Boolean | Body | 否 | false |
是否开启WebTracking功能。默认值为false。
|
maxSplitShard | Integer | Body | 否 | 64 |
自动分裂时最大的Shard个数,最小值是1,最大值是64。 说明 当autoSplit参数为true时必须设置。
|
appendMeta | Boolean | Body | 否 | false |
是否记录外网IP地址功能。默认值为false。
|
telemetryType | String | Body | 否 | None |
要查询的日志类型。取值包括:
|
hot_ttl | Integer | Body | 否 | 60 |
数据在Logstore热存储层中的存储时间,最少为30天。单位:天,取值范围为30到您设置的ttl之间。 当数据的存储时间超过您所配置的热存储层数据保存时间后,数据将转为冷存储。更多信息,请参见智能冷热分层存储。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Server | String | nginx |
服务器名称。 |
Content-Type | String | application/json |
响应内容类型。类型支持application/json、application/x-protobuf两种类型。 |
Content-Length | String | 0 |
响应内容长度。 |
Connection | String | close |
是否长链接。取值包括:
|
Date | String | Sun, 27 May 2018 08:25:04 GMT |
当前返回响应的时间。 |
x-log-requestid | String | 5B0A6B60BB6EE39764D458B5 |
服务端产生的标示,该请求的唯一ID。 |
示例
请求示例
POST /logstores HTTP/1.1
Host:sls.aliyuncs.com
Content-Type:application/json
{
"logstoreName" : "my-logstore",
"shardCount" : 2,
"ttl" : 1,
"encrypt_conf" : {
"encrypt_type" : "default",
"user_cmk_info" : { }
},
"autoSplit" : true,
"enable_tracking" : false,
"maxSplitShard" : 64,
"appendMeta" : false,
"telemetryType" : "None",
"hot_ttl" : 60
}
正常返回示例
JSON
格式
HTTP/1.1 200 OK
错误码
访问错误中心查看更多错误码。
HttpStatusCode |
ErrorCode |
ErrorMessage |
错误码描述 |
---|---|---|---|
404 |
ProjectNotExist |
Project does not exist. |
Project不存在。 |
400 |
LogstoreAlreadyExist |
Logstore already exists. |
Logstore已存在。 |
400 |
LogStoreInfoInvalid |
Logstore info is invalid |
Logstore信息无效。 |
400 |
ProjectQuotaExceed |
Project Quota Exceed. |
超过Project限额。 |
500 |
InternalServerError |
Specified Server Error Message. |
内部服务调用错误。 |
更多信息,请参见通用错误码。