If an exception occurs in your application, you can use logs to accurately identify the exception. The log analysis feature allows you to analyze logs that are collected by Log Service or Application Real-Time Monitoring Service (ARMS). This topic describes how to enable the log analysis feature and analyze logs that are collected by Log Service.
Prerequisites
- The data of your application is imported to ARMS Application Monitoring. For more information, see Overview.
- Log Service is activated. If Log Service is not activated, log on to the Log Service console and activate Log Service by following the on-screen instructions.
- A Log Service project is created. For more information, see Create a project.
- A Log Service Logstore is created. For more information, see Create a Logstore.
Log sources
The log analysis feature supports logs that are collected by Log Service or ARMS. This topic describes how to query and analyze logs that are collected by Log Service. For more information about how to analyze logs that are collected by ARMS, see Analyze logs collected by ARMS.
- Analyze logs collected by ARMS: You can use the ARMS agent to collect the output of the log framework and push the collected logs to the log analysis center of ARMS. After you enable the log analysis feature, you can query and analyze the logs of your application in the ARMS console without the need to perform other operations. Note If you analyze logs collected by ARMS, you must upgrade the ARMS agent to V2.7.1.4 or later.
- Analyze logs collected by Log Service:
You must make sure that the logs of your application are collected to Log Service. Then, you must specify the project and Logstore that store the logs on the Application Settings page of the ARMS console. To help you analyze logs, the console pages of Log Service are embedded in ARMS.
Step 1: Associate logs with trace IDs
- Log on to the ARMS console. In the left-side navigation pane, choose .
- On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage. Note If the icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Tracing Analysis.
- In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.
- In the Business log Association settings section of the Custom Configuration tab, set the log source to Log Service, turn on Link Business Logs with TraceId, select the region where Log Service resources are deployed, and then select the project and Logstore that you created.
- On the Custom Configuration tab, click Save in the lower-left corner.
Step 2: Query and analyze logs
- Log on to the ARMS console. In the left-side navigation pane, choose .
- On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage. Note If the icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Tracing Analysis.
- In the left-side navigation pane, choose .
- On the Log Analysis page, perform the following operations: