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:
- 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.
- Scroll up/down based on the error log until you locate the desired context of the log.
- Log in to the CLS console.
- On the left sidebar, click Log Search to go to the Search and Analysis page.
- Select the Region, Logset, and Log Topic as needed.
- Enter the search syntax, select a time range, and click Search and Analysis.
- On the Raw Data tab, find the time of the error log and click to go to the context search and analysis page.
- 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.