Help Center > > User Guide> Log View> Searching for Logs by Keyword

Searching for Logs by Keyword

Updated at: Dec 03, 2019 GMT+08:00

Syntax and Examples of Searching by Keyword

Table 1 describes the search syntax.
Table 1 Search syntax

Filter

Description

Exact search by keyword

Search for keywords in logs precisely. A keyword is between two adjacent words and is case-sensitive.

Exact search by phrase

Search for phrases in logs in precisely. Phrases are case-sensitive.

&&

Intersection of search results

||

Union of search results

AND

Intersection of search results

NOT

Results that satisfy query1 but not query2

*

Fuzzy search. The wildcard (*) can only be after a keyword to replace an unspecified number of characters.

?

Fuzzy search. The question mark (?) can be put in the middle or at the end of a keyword to replace a character.

The rules of searching for logs by keyword are as follows:

  • Fuzzy search is supported.

    For example, if you enter error*, all logs that contain error will be displayed and especially those start with error will be highlighted.

  • Searching through multiple filters (including hostName: , hostIP:, path:, and time:) is supported. The format is : key1:value1 [Condition] key2:value2. For example, hostName:ecs-rxm NOT hostIP:x.x.x.x.

The following are examples:

  • Search for logs containing Start: Enter Start.
  • Search for logs containing Start to refresh: Enter Start to refresh.
  • Search for logs containing both Start and Unexpected: Enter Start && Unexpected.
  • Search for logs containing Start or Unexpected: Enter Start || Unexpected.
  • Search for logs containing both Start and Unexpected: Enter Start AND Unexpected.
  • Search for logs containing Start instead of Unexpected: Enter Start NOT Unexpected.
  • error*: logs that contain error
  • er?or: logs that start with er, is followed by any single character, and end with or
  • query1 AND query2 NOT query3: logs that contain query1 and query2 but not query3
    • When you enter a keyword to query logs, the keyword is case-sensitive. Log contents you queried are case-sensitive but the highlighted log contents are case-sensitive.
    • Fuzzy search. The wildcard and question mark cannot be replaced with some special characters such as hyphens (-) and spaces.

Searching for Logs

To set keywords or the time range, perform the following operations:

  1. Log in to the management console.
  2. Click in the upper left corner to select the desired region and project.
  3. Choose Service List > Management & Deployment > Log Tank Service.
  4. In the log group list, click the name of the target log group.
  5. In the log stream list, click the name of the target log stream.

    You can also click Search in the Operation column on the log stream list page to go to the log stream details page.

  6. On the displayed page, enter your keyword in the search box.
    Figure 1 Searching for logs
  7. Click to start the search.

    Logs containing the keyword are displayed.

Configuring Quick Search

To search for logs using a keyword repeatedly, perform the following operations to configure quick search:

  1. Log in to the management console.
  2. Click in the upper left corner to select the desired region and project.
  3. Choose Service List > Management & Deployment > Log Tank Service.
  4. In the log group list, click the name of the target log group.
  5. In the log stream list, click the name of the target log stream.

    You can also click Search in the Operation column on the log stream list page to go to the log stream details page.

  6. Set filter criteria.

    For example, enter error*.

  7. Click Save As and choose Save As Quick Search.
    Figure 2 Saving as quick search
  8. Enter a quick search name.

    The quick search name must meet the following requirements:

    • Each name must be a string of 1 to 64 characters.
    • Only letters, digits, underscores, hyphens, and periods (.) are allowed. The name cannot start or end with a period.
    • Each name must be unique in the same log stream.
  9. Click OK.
  10. Click Quick Searches in the navigation pane.
    The search result is displayed.
    Figure 3 Quick searches

Viewing Context of a Log

To facilitate fault locating during O&M, perform the following operations to query logs generated before and after a specified log is generated:

  1. Log in to the management console.
  2. Click in the upper left corner to select the desired region and project.
  3. Choose Service List > Management & Deployment > Log Tank Service.
  1. In the log group list, click the log group to be viewed.
  2. In the log stream list, click the log stream to be viewed.

    You can also click Search in the Operation column on the log stream list page to go to the log stream details page.

  3. In the search result, click View Context on the right of the log to be viewed.

    Details of several logs generated before and after the log is displayed.

    Figure 4 Viewing context

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel