Creates indexes for a Logstore.
Operation description
Host consists of a project name and a Simple Log Service endpoint. You must specify a project in Host.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
log:CreateIndex | create |
|
| none |
Request syntax
POST /logstores/{logstore}/index HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
logstore | string | Yes | The name of the Logstore. | ali-logstore-test |
project | string | Yes | The name of the project. | ali-project-test |
body | object | No | The request body. | |
keys | object | No | The configuration of field indexes. A field index is a key-value pair in which the key specifies the name of the field and the value specifies the index configuration of the field. You must specify this parameter, the line parameter, or both parameters. For more information, see Example. | |
object | No | The index configuration of the field. | ||
caseSensitive | boolean | No | Specifies whether to enable case sensitivity. This parameter is required only when type is set to text. Valid values:
| false |
chn | boolean | No | Specifies whether to include Chinese characters. This parameter is required only when type is set to text. Valid values:
| false |
type | string | Yes | The data type of the field value. Valid values: text, json, double, and long. | text |
alias | string | No | The alias of the field. | myAlias |
token | array | No | The delimiters that are used to split text. | |
string | No | The delimiter. | . | |
doc_value | boolean | No | Specifies whether to turn on Enable Analytics for the field. | false |
line | object | No | The configuration of full-text indexes. You must specify this parameter, the keys parameter, or both parameters. For more information, see Example. | |
chn | boolean | No | Specifies whether to include Chinese characters. Valid values:
| false |
caseSensitive | boolean | No | Specifies whether to enable case sensitivity. Valid values:
| false |
token | array | Yes | The delimiters. You can specify a delimiter to delimit the content of a field value. For more information about delimiters, see Example. | |
string | No | The delimiter. You can specify a delimiter to delimit the content of a field value. For more information about delimiters, see Example. | , | |
include_keys | array | No | The included fields. You cannot specify both include_keys and exclude_keys. | |
string | No | The included field. You cannot specify both include_keys and exclude_keys. | includeKey | |
exclude_keys | array | No | The excluded fields. You cannot specify both include_keys and exclude_keys. | |
string | No | The excluded field. You cannot specify both include_keys and exclude_keys. | excludeKey | |
ttl | integer | No | The retention period of logs. Unit: days. Valid values: 7, 30, and 90. | 30 |
max_text_len | integer | No | The maximum length of a field value that can be retained. Default value: 2048. Unit: bytes. The default value is equal to 2 KB. You can change the value of max_text_len. Valid values: 64 to 16384. | 2048 |
log_reduce | boolean | No | Specifies whether to turn on LogReduce. After you turn on LogReduce, either the whitelist or blacklist takes effect. | false |
log_reduce_white_list | array | No | The fields in the whitelist that you want to use to cluster logs. | |
string | No | The field in the whitelist that you want to use to cluster logs. | a | |
log_reduce_black_list | array | No | The fields in the blacklist that you want to use to cluster logs. | |
string | No | The field in the blacklist that you want to use to cluster logs. | b |
Response parameters
Examples
Sample success responses
JSON
format
{}
Error codes
For a list of error codes, visit the Service error codes.