The log analysis feature of Managed Service for OpenTelemetry depends on Log Service. The Managed Service for OpenTelemetry console is embedded with the Log Service console page where you can analyze logs. If an error occurs when your application is running, you can query and analyze logs in the Managed Service for OpenTelemetry console to troubleshoot the error.

Prerequisites

  • The application is connected to Managed Service for OpenTelemetry. For more information, see Preparations.
  • Log Service is activated. If Log Service is not activated, log on to the Log Service console and activate Log Service as prompted.
  • 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 Managed Service for OpenTelemetry console. In the left-side navigation pane, click 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.
  3. In the left-side navigation pane, click Application Settings.
  4. In the Business log Association settings section of the Custom Configuration tab, specify a project and Logstore and configure 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 Create indexes.
  5. In the lower-left corner of the Custom Configuration tab, click Save.

Step 2: Query and analyze logs

  1. In the left-side navigation pane, click Log Analysis.
  2. 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 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.