- Automatically attach trace, transaction, and span IDs to your application logs.
- Seamlessly connect logs and traces within the Atatus dashboard.
- Navigate from any log entry to its corresponding trace and vice versa.
Log Correlation
Log correlation lets you trace individual requests across systems by adding correlation identifiers to your logs. To correlate logs from your application with transactions captured by the Atatus Go Agent, your logs must contain one or more of the following identifiers:
These IDs connect your logs with traces, making it easy to jump from a log entry to its related transaction in the Atatus dashboard.
Supported Logging Frameworks
The Atatus Go Agent ships with dedicated integrations for the following logging frameworks:- logrus: via
go.atatus.com/agent/module/atlogrus - zap: via
go.atatus.com/agent/module/atzap - zerolog: via
go.atatus.com/agent/module/atzerolog
logrus
Install the Atatus Go agent and the logrus integration module:atlogrus.TraceContext to enrich log entries with the active trace, transaction, and span IDs:
zap
Install the Atatus Go agent and the zap integration module:atzap.TraceContext to enrich log entries with the active trace, transaction, and span IDs:
zerolog
Install the Atatus Go agent and the zerolog integration module:atzerolog.Writer as an additional output, and add atzerolog.TraceContextHook to inject trace IDs into request-scoped loggers:
Manual Log Correlation
If the agent’s built-in logging integrations don’t fit your application (for example, you use a different logging framework or want full control over how IDs are written), you can use the agent’s public API to inject trace IDs manually. There are two approaches depending on whether your logs are structured or unstructured.Manual Correlation in Structured Logs
For structured logs, attach thetrace.id, transaction.id, and span.id fields directly to your log events.
Given a *atatus.Transaction, obtain its trace and transaction IDs using Transaction.TraceContext(). Similarly, given a *atatus.Span, obtain its span ID using Span.TraceContext().
If you start transactions and spans through the context APIs, retrieve them with atatus.TransactionFromContext and atatus.SpanFromContext. Note that if a transaction is not sampled, TransactionFromContext returns nil. Similarly, spans may be dropped, so SpanFromContext may also return nil.
Manual Correlation in Unstructured Logs
For unstructured (plain text) logs (such as the standard library’slog package or basic printf-style logging), embed the trace IDs directly into the log message.
If you already have a transaction or span object, use the TraceContext() methods. The trace, transaction, and span ID types all provide String() methods that return their canonical hex-encoded representations:
context.Context objects instead, use atatus.TraceFormatter for a more concise call site: