Log analysis

Updated at:

The log analysis feature of Managed Service for OpenTelemetry relies on Simple Log Service (SLS). The log center page is integrated into the Managed Service for OpenTelemetry console. If a business exception occurs in your application, you can use log analysis in the Managed Service for OpenTelemetry console to accurately locate the exception.

Prerequisites

Step 1: Associate business logs

  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.

  3. In the navigation pane on the left, click Application Settings.

  4. On the Custom Configuration tab, in the Business Log Association Settings section, bind the Project and Logstore, and set the Associated Index.

    Note

    The Associated Index is used to retrieve the TraceID and view the logs that correspond to a trace.

    • If the index configured in Simple Log Service is a full-text index, set Associated Index to Full-text Index.

    • If the index configured in Simple Log Service is a field index for traceId, set Associated Index to the corresponding traceId index. To print the TraceID in logs, see the documentation for the TraceID printing feature of your tracing framework.

    For more information about how to configure an index, see Create an index.

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

Step 2: Query and analyze logs

  1. In the navigation pane on the left, click Log Analysis.

  2. On the page that appears, complete the following steps:

    1. In the search box, enter a query and analysis statement.

      A query and analysis statement consists of a query statement and an analytic statement. The format is Query Statement|Analytic Statement. For more information about the syntax, see Query syntax and functions and SQL analytic syntax.

    2. Set the time range for the query and analysis.

      You can set a relative time, a time frame, or a custom time.

      Note

      Query results may have a margin of error of up to 1 minute.

    3. Click Query/Analysis to view the results.