Analyze business logs to pinpoint the cause of an application exception. This topic shows how to correlate logs from Simple Log Service (SLS) with traces in Managed Service for OpenTelemetry.
Prerequisites
-
Your application data is reported to Managed Service for OpenTelemetry. For more information, see Integrate services or components.
-
A project has been created. For more information, see Manage projects.
-
A logstore has been created. For more information, see Create a basic logstore.
-
SLS data collection is configured. For more information, see Data collection.
Associate business logs with traces
Log sources
You need to collect application logs to Simple Log Service (SLS) and configure the binding between the application and a Project/Logstore in the log association configuration of Managed Service for OpenTelemetry. Managed Service for OpenTelemetry will then embed the Simple Log Service page to facilitate your log analysis.
Associate business logs
Log on to the Managed Service for OpenTelemetry console.
-
In the left-side navigation pane, choose . In the top menu bar, select the target region.
NoteThe Log Association page lists applications that are associated with SLS logstores. In the Actions column, you can Edit or Delete an association.
-
On the Log Association page, click Create to add an association between an application and an SLS logstore.
-
In the Add Log Association dialog box, select the applications to associate, the Simple Log Service region, project, and logstore. Then, map the TraceId to the corresponding field in the logstore and click OK.
Query and analyze logs
-
In the left-side navigation pane, click Trace Explorer.
-
In the trace list, click Logs in the Actions column to view the business logs associated with the trace.