When application errors occur, correlating logs with distributed traces helps you identify root causes faster. Managed Service for OpenTelemetry lets you query and analyze application logs alongside trace data by embedding the Log Service query interface directly in the OpenTelemetry console.
The setup has two parts: associate your Log Service data with trace IDs, then query and analyze the logs.
Prerequisites
Before you begin, make sure you have:
An application connected to Managed Service for OpenTelemetry. See Preparations
Log Service activated. If not yet activated, log on to the Log Service console and follow the prompts
Application logs collected and reported to Log Service. See Data collection overview
Associate logs with trace IDs
Configure the link between your Log Service data and trace IDs so that log entries can be matched to specific traces.
Log on to the Managed Service for OpenTelemetry console.
In the left-side navigation pane, click Applications.
On the Applications page, select a region in the top navigation bar, then click the name of your application.
In the left-side navigation pane, click Application Settings.
On the Custom Configuration tab, find the Business log Association settings section and set the following parameters:
Parameter Description project The Log Service project that stores your application logs. Logstore The Logstore within that project. Associated index The index type used to query logs by trace ID. See the guidance below. How to choose the Associated index value:
If full-text indexing is enabled in Log Service, select Full-text index.
If trace ID-based field indexing is enabled, select the configured index field.
NoteFor information about displaying trace IDs in logs, see the documentation for your tracing system. For index configuration details, see Create indexes.In the lower-left corner of the Custom Configuration tab, click Save.
Query and analyze logs
After the association is configured, you can search and analyze log data from the Log Analysis page.
In the left-side navigation pane, click Log Analysis.
Enter a query statement in the search box.
A query statement uses the format Search statement|Analytic statement. For syntax details, see Search syntax and SQL syntax and functions.
Set the time range for the query.
You can specify an exact start and end time (in hours or down to the second), or set a relative time window without fixed boundaries.
NoteQuery results may include logs generated up to 1 minute before the specified start time or up to 1 minute after the specified end time.
Click Search & Analyze to view the results.