- Microsoft.Extensions.Logging (ILogger): the agent sends your
ILoggerlogs to Atatus directly. You only enable one setting. - Serilog: send logs to Atatus with the
Atatus.Serilog.Sinkssink, or add correlation IDs to logs you ship yourself with theAtatus.SerilogEnricherenricher. - NLog: send logs to Atatus with the
Atatus.NLog.Targetstarget, or add correlation IDs to logs you ship yourself with theAtatus.NLoglayout renderers.
How log correlation works
Correlation adds a set of identifiers to each log record produced while a request is being traced:
These IDs let the Atatus dashboard link a log line to its related trace and transaction, so you can move between logs and traces while debugging. Every integration on this page attaches them automatically.
Microsoft.Extensions.Logging (ILogger)
If your application usesMicrosoft.Extensions.Logging.ILogger, the default logging abstraction in ASP.NET Core and modern .NET applications, the Atatus .NET Agent can send your logs to Atatus directly, with correlation IDs already attached. There is no enricher, sink, or extra NuGet package to add. It is built into the agent.
Enable it by setting CaptureLogs to true. It is disabled by default:
ATATUS_CAPTURE_LOGS=true. See Customizing the agent for all configuration options.
Once enabled, the agent hooks into the ILogger pipeline and sends every log event to Atatus along with the active trace, transaction, and span IDs. As long as the agent is registered in your application (for example, via builder.Services.AddAllAtatus()), each ILogger call is captured and visible in the Atatus Logs dashboard:
CaptureLogs, you do not need to add any enricher, layout renderer, sink, or manual ID injection. The agent handles capture, correlation, and delivery behind the scenes.
Logs of every level are sent to the Logs dashboard. Log events at
Error or Critical level are also captured as APM errors under Error Tracking.Serilog
For Serilog, you have two options: let the sink send logs to Atatus for you, or write logs yourself and add correlation IDs to them.Send Serilog logs to Atatus
TheAtatus.Serilog.Sinks package provides a sink that sends log events straight to Atatus, with correlation fields attached automatically. No enricher is needed.
This page assumes the Atatus .NET Agent is already running in the same process (for example via builder.Services.AddAllAtatus()). If it is not, see .NET Core Agent Installation first. The sink reuses the agent’s license key, app name, and endpoint, so you do not set them.
Install the package:
appName: "my-worker" to .WriteTo.Atatus(...).
Add correlation IDs to Serilog logs you ship yourself
If you prefer to write Serilog logs to the console or a file yourself and let the Atatus Infra Agent forward them to Atatus, use theAtatus.SerilogEnricher enricher. It adds correlation IDs to each log line but does not send the logs itself. The Infra Agent handles delivery.
Enable it when configuring your logger. Add the using directive so the WithAtatusCorrelationInfo() extension method is in scope:
AtatusTraceIdAtatusTransactionId
NLog
For NLog, you have two options: let the target send logs to Atatus for you, or write logs yourself and add correlation IDs to them.Send NLog logs to Atatus
TheAtatus.NLog.Targets package provides a target that sends log events straight to Atatus, with correlation fields attached automatically. No layout renderer is needed.
This page assumes the Atatus .NET Agent is already running in the same process (for example via builder.Services.AddAllAtatus()). If it is not, see .NET Core Agent Installation first. The target reuses the agent’s license key, app name, and endpoint, so you do not set them.
Install the package:
nlog.config, with no attributes:
AppName on the target (or the appName attribute in nlog.config).
Add correlation IDs to NLog logs you ship yourself
If you prefer to write NLog logs to the console or a file yourself and let the Atatus Infra Agent forward them to Atatus, use theAtatus.NLog layout renderers. They add correlation IDs to each log line but do not send the logs themselves. The Infra Agent handles delivery.
1. Register the extension in nlog.config
Add the package to the <extensions> section and reference the layout renderers from any target layout:
${AtatusTraceId}: current trace ID${AtatusTransactionId}: current transaction ID${AtatusSpanId}: current span ID
2. Load the configuration in Program.cs
Add the required using directives and load the nlog.config file at application startup:
using Atatus.NLog; directive ensures the Atatus layout renderers are loaded into the NLog runtime alongside the assembly registration in nlog.config.
To get these logs into Atatus, write them to the console or a file and let the Atatus Infra Agent collect them. See Ship logs with the Atatus Infra Agent.
Correlate logs manually
If none of the built-in integrations fit your application, for example you use a different logging framework or want full control over how IDs are written, use the agent’s public API to inject trace IDs manually. There are two approaches, depending on whether your logs are structured or unstructured.Structured logs
For structured logs, attach these fields directly to your log events:trace.idtransaction.id
Agent.Tracer.CurrentTransaction property anywhere in your code to read the active transaction’s IDs:
traceId and transactionId to your structured log events under the trace.id and transaction.id fields.
Unstructured logs
For unstructured (plain text) logs, such asConsole.WriteLine or basic printf-style logging, embed the IDs directly into the log message string:
Ship logs with the Atatus Infra Agent
Use this only if your app writes logs to the console or a file (with the enricher or layout renderers) instead of using the sink or target. The Atatus Infra Agent, running in the same environment as your service, collects those logs and forwards them to Atatus:- Containers (Docker, Kubernetes): log to stdout or stderr and the agent picks them up automatically.
- VMs or bare metal: write logs to a file, then point the agent at it by following Custom Files.
Delivery and troubleshooting
The sink and target batch logs in memory and flush every few seconds, so a hard crash can lose the last batch. For stronger delivery guarantees, write logs to a file and ship that file with the Atatus Infra Agent. If no logs appear in Atatus:- Confirm the Atatus .NET Agent is configured and running in the same process, since the sink and target rely on it for the license key, app name, and endpoint.
- For NLog, add
internalLogLevel="Warn" internalLogToConsole="true"to the<nlog>root element to surface otherwise-silent delivery errors.