The log analysis feature of Tracing Analysis depends on Log Service. The Tracing Analysis console is embedded with the Log Service console page where you can analyze logs. If an exception occurs when your application is running, you can query and analyze logs in the Tracing Analysis console to handle the exception.

Prerequisites

  • The application is monitored by Application Real-Time Monitoring Service (ARMS). 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.
  • Application logs are collected and reported to Log Service. For more information, see Data collection overview.

Step 1: Associate logs with trace IDs

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, choose Tracing Analysis > Applications.
  3. On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.
  4. In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.
  5. In the Business log Association settings section of the Custom Configuration tab, specify a project and a Logstore in Log Service and set the Associated index parameter.
    Note
    The Associated index parameter is used in the queries of logs based on trace IDs.
    • If full-text indexing is enabled in Log Service, set the Associated index parameter to Full-text index.
    • If trace ID-based field indexing is enabled in Log Service, set the Associated index parameter to the configured index. For information about how to display trace IDs in logs, see the related descriptions in the topics for different tracing systems.
    For information about how to configure indexes, see Configure indexes.
  6. 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.
  2. In the left-side navigation pane, choose Tracing Analysis > Applications.
  3. On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.
  4. In the left-side navigation pane, click Log Analysis.
  5. 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 format of Search statement|Analytic statement. For more information, see Search syntax and SQL syntax and functions.
    2. Specify the time range for the query and analysis.
      You can select a relative time, set a time frame, or customize a time range.
      Note The query results may contain logs that are generated 1 minute earlier or later than the specified time range.
    3. Click Search & Analyze to view the query and analysis results.