All Products
Search
Document Center

Application Real-Time Monitoring Service:Use the log analysis feature

Last Updated:Jul 25, 2024

The log analysis feature allows you to use logs to accurately identify service exceptions that occur in your application. The log analysis feature allows you to analyze the logs that are collected by Simple Log Service or Application Real-Time Monitoring Service (ARMS). This topic describes how to enable the log analysis feature and analyze the logs collected by Simple Log Service.

Prerequisites

Step 1: Associate business logs with trace IDs

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Application List.

  2. On the Application List page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.

  4. In the Log Collect Configuration section of the Custom Configuration tab, turn on the Link Business Logs with TraceId switch, select the region where the Simple Log Service project resides, and then associate the project with the Logstore.

  5. In the lower-left corner of the Custom Configuration tab, click Save.

Step 2: Query and analyze logs

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Application List.

  2. On the Application List page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, choose Application Diagnosis > Log Analysis.

  4. On the page that appears, perform the following operations:

    1. Enter a query statement in the search box.

      A query statement is in the Search statement|Analytic statement format. For more information, see Search syntax and Function overview.

    2. Specify a time period for query.

      You can set a custom time period by specifying the start time and end time. The start time and end time can be in hours or accurate to the second. You can also set a time length without specifying the start time or end time.

      Note

      The query results may contain logs that are generated 1 minute earlier or later than the specified time period.

    3. Click Search & Analyze to view the query and analysis results.

    日志分析

References

You can associate trace IDs with the business logs of an application. This way, if an error occurs in the application, you can access the business logs associated with trace IDs to identify and troubleshoot the error. For more information, see Associate trace IDs with business logs.