All Products
Search
Document Center

Application Real-Time Monitoring Service:Associate trace IDs with logs for a Go application

Last Updated:Mar 10, 2026

When debugging a failed request in a Go application, you need to correlate the trace that captured the failure with the application logs that recorded what happened. Application Real-Time Monitoring Service (ARMS) automatically injects trace IDs into your Go application logs through log framework instrumentation. From a slow or failed trace in the ARMS console, you can jump directly to the associated log entries in Simple Log Service (SLS) and pinpoint the root cause.

How trace-log association works

The ARMS agent for Go instruments supported log frameworks at initialization. Once enabled:

  1. The agent hooks into your log framework when the application starts.

  2. Each log entry automatically includes the traceId field from the active span.

  3. SLS indexes these fields, linking log entries to the corresponding traces in the ARMS console.

No code changes are required. The ARMS agent handles injection transparently for all supported log frameworks.

Supported log frameworks

The ARMS agent instruments the following Go log frameworks. Verify that your framework version falls within the supported range before enabling trace-log association.

Framework

Repository

Minimum version

Maximum version

Zerolog

github.com/rs/zerolog

v1.10.0

v1.33.0

Zap

github.com/uber-go/zap

v1.20.0

v1.27.0

Logrus

github.com/sirupsen/logrus

v1.5.0

v1.9.3

Log

pkg.go.dev/log

Go 1.21

N/A

Slog

pkg.go.dev/log/slog

Go 1.21

N/A

Log and Slog are part of the Go standard library. The minimum version refers to the Go release version, not a module version.

If your log framework version falls outside the supported range, upgrade or downgrade to a compatible version before you enable trace-log association.

Prerequisites

Before you begin, ensure that you have:

  • A Go application compiled and deployed with the ARMS agent for Go

  • Log collection configured through Simple Log Service. For more information, see Data collection overview

Enable trace ID injection

Step 1: Open the application settings

  1. Log on to the ARMS console.

  2. In the left-side navigation pane, choose Application Monitoring > Application List.

  3. Select a region in the top navigation bar and click your application.

    Icons in the Language column indicate the programming language: - Java icon: Java - Go icon: Go - Python icon: Python - - (Hyphen): an application monitored in Managed Service for OpenTelemetry

Step 2: Configure log association

  1. In the top navigation bar, choose Configuration > Custom Configurations.

  2. In the Application log Association configuration section of the Custom Configurations tab, configure the following settings:

    SettingValue
    Log SourceLog service SLS
    Automatically associate business logs with TraceIdTurn on
    RegionSelect the region where your Simple Log Service is deployed
    Project and LogstoreBind the project and Logstore that store your application logs

    Application log association configuration

Step 3: Verify the association

Open your application logs and confirm that trace IDs appear in the log entries. The following figure shows a successful association.

Trace IDs in application logs

Step 4 (optional): Upload application logs to SLS

By default, the ARMS agent for Go does not collect application logs. To upload application logs to SLS, configure log collection and specify the target project and Logstore.

Log collection configuration

Considerations

  • The ARMS agent injects trace IDs automatically. No code changes are required for the supported log frameworks listed above.

  • If you switch log frameworks, verify that the new framework and version are within the supported range.