sample as follows:10.20.20.10;[2018-07-16 13:12:57];GET /online/sample HTTP/1.1;200
sample, which does not exactly match the search condition, you cannot use sample directly for searching. To meet this search condition, the full log text needs to be split into multiple segments. Each segment is called a "token", and this process is called "tokenization".@&()='",;:<>[]{}/ \\n\\t\\r\\\\ appears, the log is split, resulting in the following tokens:
sample, if the preceding tokenized log contains sample, it is considered to meet the search condition.
"/online/sample"online and sample, and the tokens appear in the exact order specified by the search condition; therefore, it matches the condition."/online/login"login, and does not meet the search condition.Category | Description |
Full-text index | Tokenizes the complete log content into multiple tokens for indexing. Searches, specifically full-text searches, are conducted directly using keywords. For example, using the keyword error will retrieve all logs containing the term "error." |
Key-value index | Tokenizes the raw log into multiple tokens based on fields (that is, key:value pairs) for indexing. Searches, specifically key-value searches, are conducted using these key-value pairs. For example, you can use level:error AND timeCost:>1000 to locate logs where the log level (level) is "error" and the processing time (timeCost) exceeds 1,000 ms.Some logs also contain special metadata fields. These fields are configured for indexing in the same manner as regular fields. |
Configuration Item | Capability Description |
Full-Text Delimiter | The set of characters used for tokenizing raw logs supports only English symbols. The default delimiters in the console are: @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\. |
Case Sensitivity | Determines whether search operations are case-sensitive. For example, if a log entry contains "Error" and case sensitivity is enabled, searching for "error" will not return this log entry. |
Allow Chinese Characters | This feature can be enabled when logs contain Chinese characters and the Chinese characters need to be searched. For example, if the original text of a log is in Chinese, and this feature is disabled, you cannot query the log by using a Chinese keyword contained in the original text. The query can be successful only if you use the exact raw log text to query the log. However, if you enable this feature, you can query the log by using a Chinese keyword contained in the raw log text. |
Configuration Item | Capability Description | |
Overall Configuration | Case Sensitivity | Whether case sensitivity is applied during search. For example, if the log is "level:Error," and case sensitivity is enabled, using level:error will not retrieve this log. |
| Auto Configure | Whether to enable automatic key-value index configuration. Once enabled, fields in logs are automatically added to the key-value index, including any new fields that appear subsequently. For field addition rules, see Automatic Configuration. |
Field configuration | Field Name | Field name in structured logs. A maximum of 300 fields can be added to the key-value index of a single log topic. Letters, digits, and special characters (except for *\\",) are supported. The name cannot start with _ (except for the __CONTENT__ field).When the field type does not include json, you cannot include both parent and child fields, such as a and a.b. |
| Field Alias | Use an alias instead of the original field name for search and analysis. For example, add an alias ip for the __SOURCE__ field.An alias can only contain letters, digits, and underscores, and must start with a letter. Only CQL syntax is supported. Lucene syntax is not supported. |
| Field Type | Data type of a field, including text, long, double, and json. The text and json types support fuzzy search using wildcards but do not support range comparison. The long and double types support range comparison but do not support fuzzy search. When you use the json type, you can add child fields. Child fields can be set to the text, long, or double type, or you can continue using the json type to add deeper-level fields. Note: The json type is currently supported only for some users or log topics. To use this feature, please contact us to enable the feature allowlist. When the json type exists in the index configuration, a field name in the a.b format strictly represents the log field name as the string a.b, and no longer represents the child field b of the a object. |
| Delimiter | Set of characters used to segment field values. Only English symbols are supported. The default delimiter in the console is @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\. |
| Allow Chinese Characters | This feature can be enabled when logs contain Chinese characters and the Chinese characters need to be searched. For example, if the original text of a log is in Chinese, and this feature is disabled, you cannot query the log by using a Chinese keyword contained in the original text. The query can be successful only if you use the exact raw log text to query the log. However, if you enable this feature, you can query the log by using a Chinese keyword contained in the
raw log text. |
| Enable Statistics | Once enabled, this field can be used in SQL for statistical analysis. For text fields, if the value is too long, only the first 32,766 characters will participate in statistical operations. Enabling statistics will not incur extra fees, and it is recommended to enable it. |
Built-in Reserved Field | Description | Key-Value Index Configuration |
__FILENAME__ | File name from which the log was collected. You can use this field to search logs under a specific file. For example: __FILENAME__:"/var/log/access.log" searches the logs in //var/log/access.log. | text type, no delimiters, not allow Chinese characters, and statistics enabled. |
__SOURCE__ | Source IP address from which the log was collected. You can use this field to search logs from a specific server. For example: __SOURCE__:192.168.10.10 searches the logs from server 192.168.10.10. | text type, no delimiters, not allow Chinese characters, and statistics enabled. |
__HOSTNAME__ | Hostname of the server from which the log originated. You can use this field to search logs from a specific server. For example: __HOSTNAME__:localhost searches the logs from server localhost.Note: LogListener version 2.7.4 or later is required to collect this field. | text type, no delimiters, not allow Chinese characters, and statistics enabled. |
__TIMESTAMP__ | Log timestamp (Unix timestamp in milliseconds). When searching logs by time range, this time will be automatically used for the search, and you do not need to specify it in the search statement. Displayed as "Log Time" in the console. | long type; statistics enabled. |
__INDEX_STATUS__ | When the value is not empty, it indicates that an exception occurred during the creation of the index for the current log. The raw logs are stored in __RAWLOG__, and __INDEX_STATUS__ contains the reason for the index creation exception.You can use __INDEX_STATUS__:* to query all logs with index creation exceptions. | text type, no delimiters, not allow Chinese characters, and statistics enabled. |
Field Type | Delimiter | Chinese Characters | Enable Statistics |
text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
long | Not involved | Not involved | Enabled |
double | Not involved | Not involved | Enabled |
key1:textValuekey2:123key3:{"ip":"123.123.123.132","url":"class/132.html","detail":{"status_code":"500","id":13}}
Field Name | Field Type | Delimiter | Allow Chinese Characters | Enable Statistics |
key1 | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
key2 | long | Not involved | Not involved | Enabled |
key3 | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
Field Name | Field Type | Delimiter | Allow Chinese Characters | Enable Statistics |
key1 | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
key2 | long | Not involved | Not involved | Enabled |
key3.ip | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
key3.url | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
key3.detail | text | @&?|#()='",;:<>[]{}/ \\n\\t\\r\\\\ | Include | Enabled |
Configuration Item | Description | Recommended Configuration |
Full-text index contains internal fields | Include: The full-text index includes the three built-in fields: __FILENAME__, __HOSTNAME__, and __SOURCE__, supporting both full-text search and key-value search. For example: "/var/log/access.log", __FILENAME__:"/var/log/access.log".Exclude: The full-text index does not include these three built-in fields, and only key-value search can be used. For example: __FILENAME__:"/var/log/access.log". | Include |
Full-text index contains metadata fields | Include: Full-text index contains all metadata fields (fields prefixed with __TAG__), and relevant log fields can be retrieved directly by full-text retrieval, such as ap-beijing.Exclude: The full-text index does not contain any metadata fields, and relevant log fields can only be retrieved by key-value retrieval, such as __TAG__.region:ap-beijing. Infrequent access log topics do not support key-value retrieval, and these fields cannot be retrieved at this time.Only include metadata fields with key-value index enabled: The full-text index includes metadata fields that have key-value index enabled, but excludes metadata fields without key-value index enabled. This option is not available for infrequent access log topics. | Include |
Storage rule for log index creation exceptions | If an exception occurs during log index creation, CLS stores the raw logs in __RAWLOG__ to prevent log loss. If only some fields fail to be indexed, the failed parts can be stored in a specified field (default is RAWLOG_FAIL_PART). For details, see What does it mean when an exception occurs during index creation. | Enabling log access |

__RAWLOG__ as a fallback exception handling method. __INDEX_STATUS__ indicates the reason for the index creation exception.__RAWLOG__ only supports full-text search (full-text index needs to be enabled) and does not support key-value search, key-value indexing, or statistical analysis.__INDEX_STATUS__ supports both full-text search and key-value search. Using __INDEX_STATUS__:* will allow you to query all logs with index creation exceptions.__RAWLOG__ field, and only full-text search can be used.
__RAWLOG__ field and the fields that have been successfully indexed.

フィードバック