tencent cloud


Context Search and Analysis

Last updated: 2022-06-06 14:19:57

    This document describes how to view the context of a log in the original file in the CLS console.


    Log context search refers to searching for the log’s context, that is, several logs before or after the log itself. This feature allows you to troubleshoot quickly whenever an error occurs.


    • Log context search frees you from the hassles associated with machine logins. On the log search page, you can quickly view the log context of any file/machine.
    • Knowing the actual error occurrence time, you can specify a time range on the log search page to quickly locate the suspicious log and query its context for troubleshooting.
    • Storage capacity of the server or data loss caused by log rotation will not be a problem. The data history can be viewed on the log search page anytime.


    • Log context search and analysis are available only for version 2.3.5 and above. You are advised to install or upgrade to the latest version.
    • Context search is supported for only logs collected by LogListener.
    • You have enabled and configured index. For more information, please see Configuring Index.


    The common process of an order is as follows: log in > browse merchandise > select merchandise> add merchandise to the shopping cart > place an order > pay for the order > make a deduction > generate the order.
    Use case: if one of the orders of a user fails, you can query the error log using the order number. Then, locate the log’s context to find out the cause (for example, order deduction failed).
    You can troubleshoot in CLS as follows:

    1. Log in to the CLS console and go to the Search and Analysis page. Then, specify a time range based on the error occurrence time and enter the keyword (order number) to locate the error log of the order.
    2. Scroll up/down based on the error log until you locate the desired context of the log.


    1. Log in to the CLS console.
    2. On the left sidebar, click Log Search to go to the Search and Analysis page.
    3. Select the Region, Logset, and Log Topic as needed.
    4. Enter the search syntax, select a time range, and click Search and Analysis.
    5. On the Raw Data tab, find the time of the error log and click to go to the context search and analysis page.
    6. On the context search and analysis page, 10 logs before and after the error log will be displayed.

    On this page, you can:

    • Scroll up/down to view the context.
      • Click Show Earlier to page up. Up to 20 previous logs can be displayed at a time.
      • Click Show More to page down. Up to 20 later logs can be displayed at a time.
    • Enter the keyword in the Highlight text box to fill the keyword in yellow.
    • Enter a string in the Filter Logs text box to highlight the string.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support