Search Logs
Operation Scenarios
This document primarily guides you on how to perform log search in the cloud development console.
Operation Steps
- Log in to the CloudBase Console - Log Search.
- Go to the log search page and click 'Activate' to enable the log search feature.
- Select the time range for the search, then enter the search syntax in the input box (supports full-text search, fuzzy keyword search, and key-value search).
Full-Text Search
Log content is segmented into multiple phrases using delimiters. Users can input specific keywords to precisely retrieve relevant logs, and fuzzy keyword matching search is also supported.
Key-Value Search
Log content is returned in JSON object format, similar to key-value pairs in the form of key:value
. Here, the key serves as a customizable attribute field for the log content object defined by the user, while the value represents the actual log content. The console also supports locating logs using the key:value
format, with the value supporting fuzzy keyword search. Fuzzy keyword search operates as follows:
Fuzzy Keyword Search
Log Service provides the capability for fuzzy search, allowing log retrieval using specific fuzzy keywords. The details are as follows:
Metacharacter | Description |
---|---|
* | Fuzzy search keyword that matches zero, one, or multiple arbitrary characters. Starting with * is not supported. For example, entering abc* returns all matched logs starting with abc . |
? | Fuzzy search keyword that matches a single character at a specific position. For example, entering ab?c returns all matched logs starting with ab , ending with c , and having exactly one character in between. |
Query Syntax
The search supports the following query syntax:
Syntax | Semantics |
---|---|
key:value | Key-value search format where the value supports fuzzy search using ? and * |
A and B | The logical "AND" operator returns the intersection of A and B. When multiple keywords are separated by spaces, the default operator is AND. |
A or B | The logical "OR" operator returns the union of A and B. |
not B | The logical "NOT" operator returns results that do not contain B. |
A not B | The logical "minus" operator returns results that match A but not B, i.e., A - B. |
A:B | Query format for key-value pairs. If the key or value contains special characters such as spaces or colons, they must be enclosed in quotes. For example, "error level":high |
'a' | The character 'a' is treated as a normal character and not processed as a syntax keyword. |
"A" | All keywords within A are treated as normal characters and are not processed as syntax keywords. |
\ | Escape character. The escaped character represents the symbol itself, for example, escaped quotation mark \" , escaped colon \: , etc. |
* | Fuzzy search keyword that matches zero, one, or multiple arbitrary characters. Starting with * is not supported. For example: entering abc* returns all matched logs starting with abc . |
? | Fuzzy search keyword that matches a single character at a specific position. For example, entering ab?c returns all matched logs starting with ab , ending with c , and having exactly one character in between. |
?
- The precedence of operators from highest to lowest is
:
>"
>and
>not
>or
. - If b is text, the difference between
a=b
anda:b
is that the former requires exact equality of a and b, while the latter means a contains b (processed according to tokenization logic and supports fuzzy search). Syntax keywords are case-insensitive.