<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: missing logs in some spans in Log Analytics</title>
    <link>https://community.dynatrace.com/t5/Log-Analytics/missing-logs-in-some-spans/m-p/296877#M1553</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Based on your description and screenshots, your OneAgent log enrichment configuration looks correct, since some spans already have correlated logs.&lt;/P&gt;&lt;P&gt;In this case, the issue is usually not configuration-related, but rather caused by missing context propagation (trace/span) in the application.&lt;/P&gt;&lt;P&gt;OneAgent is working correctly and the issue is caused by incomplete context propagation in the .NET application&lt;/P&gt;&lt;P&gt;Dynatrace can only correlate logs with spans when the log is created within the same execution context (thread/request), or the log contains trace_id and span_id.&lt;/P&gt;&lt;P&gt;If logs are generated:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;in async/await,&lt;/LI&gt;&lt;LI&gt;inside Task.Run,&lt;/LI&gt;&lt;LI&gt;in background tasks or event handlers,&lt;/LI&gt;&lt;LI&gt;or outside the request lifecycle,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;the context can be lost. In such cases, both the span and log exist, but they are not correlated.&lt;/P&gt;&lt;P&gt;That’s why you see logs only for some spans.&lt;/P&gt;&lt;P&gt;I think you should check:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;whether logs are created in the same execution context as the span,&lt;/LI&gt;&lt;LI&gt;whether your logger preserves context (e.g., Activity.Current in .NET),&lt;/LI&gt;&lt;LI&gt;whether logs contain trace_id / span_id (especially for custom ingestion).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Possible solutions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ensure proper context propagation in async flows (Activity / OpenTelemetry),&lt;/LI&gt;&lt;LI&gt;avoid losing context in Task.Run,&lt;/LI&gt;&lt;LI&gt;optionally enrich logs manually with trace_id and span_id (e.g., Serilog / NLog).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Mar 2026 07:46:54 GMT</pubDate>
    <dc:creator>t_pawlak</dc:creator>
    <dc:date>2026-03-30T07:46:54Z</dc:date>
    <item>
      <title>missing logs in some spans</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/missing-logs-in-some-spans/m-p/296876#M1552</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have some traces where some spans have logs, but others don't.&amp;nbsp;This issue occurs primarily in .NET applications.&lt;BR /&gt;I have the log enrichment options enabled in the OneAgent features:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="oneagent features.png" style="width: 540px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32517iF61C5E5B10A9CE82/image-size/large?v=v2&amp;amp;px=999" role="button" title="oneagent features.png" alt="oneagent features.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'll include an example to make it clearer; in this trace, you can see how logs appear in the span&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span with log.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32520i632BD0F130438939/image-size/large?v=v2&amp;amp;px=999" role="button" title="span with log.png" alt="span with log.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, they do not appear in this span&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span without log.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32521i237E7CB9B0576985/image-size/large?v=v2&amp;amp;px=999" role="button" title="span without log.png" alt="span without log.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I have verified that there are logs for this call, which in theory should be correlated.&lt;/P&gt;
&lt;P&gt;I still can't get all spans to have associated logs. Could you help me figure out what's causing this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2026 06:06:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/missing-logs-in-some-spans/m-p/296876#M1552</guid>
      <dc:creator>irivas1</dc:creator>
      <dc:date>2026-03-31T06:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: missing logs in some spans</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/missing-logs-in-some-spans/m-p/296877#M1553</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Based on your description and screenshots, your OneAgent log enrichment configuration looks correct, since some spans already have correlated logs.&lt;/P&gt;&lt;P&gt;In this case, the issue is usually not configuration-related, but rather caused by missing context propagation (trace/span) in the application.&lt;/P&gt;&lt;P&gt;OneAgent is working correctly and the issue is caused by incomplete context propagation in the .NET application&lt;/P&gt;&lt;P&gt;Dynatrace can only correlate logs with spans when the log is created within the same execution context (thread/request), or the log contains trace_id and span_id.&lt;/P&gt;&lt;P&gt;If logs are generated:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;in async/await,&lt;/LI&gt;&lt;LI&gt;inside Task.Run,&lt;/LI&gt;&lt;LI&gt;in background tasks or event handlers,&lt;/LI&gt;&lt;LI&gt;or outside the request lifecycle,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;the context can be lost. In such cases, both the span and log exist, but they are not correlated.&lt;/P&gt;&lt;P&gt;That’s why you see logs only for some spans.&lt;/P&gt;&lt;P&gt;I think you should check:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;whether logs are created in the same execution context as the span,&lt;/LI&gt;&lt;LI&gt;whether your logger preserves context (e.g., Activity.Current in .NET),&lt;/LI&gt;&lt;LI&gt;whether logs contain trace_id / span_id (especially for custom ingestion).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Possible solutions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ensure proper context propagation in async flows (Activity / OpenTelemetry),&lt;/LI&gt;&lt;LI&gt;avoid losing context in Task.Run,&lt;/LI&gt;&lt;LI&gt;optionally enrich logs manually with trace_id and span_id (e.g., Serilog / NLog).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2026 07:46:54 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/missing-logs-in-some-spans/m-p/296877#M1553</guid>
      <dc:creator>t_pawlak</dc:creator>
      <dc:date>2026-03-30T07:46:54Z</dc:date>
    </item>
  </channel>
</rss>

