All Products
Search
Document Center

Application Real-Time Monitoring Service:Analyze logs collected by Log Service

Last Updated:May 07, 2024

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 Application Monitoring 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.

Step 1: Associate logs with trace IDs

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

  2. 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 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 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.

    Link Business Logs with TraceId

  5. On the Custom Configuration tab, click Save in the lower-left corner.

Step 2: Query and analyze logs

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

  2. 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 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 Log Analysis page, perform the following operations:

    1. Enter a query statement in the search box.

      A query statement consists of a search statement and an analytic statement in the Search statement|Analytic statement format. For more information, see Search syntax and SQL syntax and functions.

    2. Specify the time range for query and analysis.

      You can set a custom time range by specifying the start time and end time. The start time and end time can be in hours or accurate to seconds. 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 than the specified start time or 1 minute later than the specified end time.

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

    Log analysis