<?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: Connecting log with traces using Log4J 1.x in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220549#M28022</link>
    <description>&lt;P&gt;In general - there is no way of enriching the log entries for unsupported log frameworks without modifying the application code. The approach is to retrieve the trace context information using OpenTelemetry (or OneAgent SDK which can provide that in the latest versions of the SDK) and log it along with log entries from the application.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2023 05:12:43 GMT</pubDate>
    <dc:creator>Julius_Loman</dc:creator>
    <dc:date>2023-08-14T05:12:43Z</dc:date>
    <item>
      <title>Connecting log with traces using Log4J 1.x</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220541#M28020</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'd like to connect logs with traces and I'm on Log4J 1.x for a subcomponent that cannot be upgraded to Log4J 2.x. I see Dynatrace supports automatic log enrichment for Log4j 2.x but not for Log4J 1.x. I verified the logs and don't see&amp;nbsp;dt.span_id, dt.trace_id, dt.trace_sampled and dt.entity.process_group_instance in the log files&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dynatrace.com/support/help/observe-and-explore/logs/log-monitoring/log-monitoring-configuration/log-enrichment" target="_blank" rel="noopener"&gt;https://www.dynatrace.com/support/help/observe-and-explore/logs/log-monitoring/log-monitoring-configuration/log-enrichment&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;How can I manually enrich the logs from log4j 1.x so that they are associated with a trace? I tried adding&amp;nbsp;dt.span_id, dt.trace_id, dt.trace_sampled and dt.entity.process_group_instance using a log4j pattern layout like below but the log files have empty values for these variables.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} dt.trace_id=%X{dt.trace_id} dt.span_id=%X{dt.span_id} dt.entity.process_group_instance=%X{dt.entity.process_group_instance} - %msg%n"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect with Log4J 1.x these values are not set as MDC variables so the logs don't have them as well. How do I associate the logs from Log4J 1.x to traces?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 07:30:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220541#M28020</guid>
      <dc:creator>sanjivj</dc:creator>
      <dc:date>2023-08-14T07:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting log with traces using Log4J 1.x</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220547#M28021</link>
      <description>&lt;P&gt;Hey Sanjivj,&lt;/P&gt;&lt;P&gt;While not ideal and&amp;nbsp;not for log4j 1.x but just generally for logs not being automatically linked to traces, I do remember being able to set this up using OpenTelemetry as shown here: &lt;A href="https://www.dynatrace.com/support/help/observe-and-explore/logs/log-management-and-analytics/lma-log-enrichment#retrieve-span-and-trace-ids" target="_blank"&gt;Connecting log data to traces | Dynatrace Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Another example in Lambda functions can be seen here:&amp;nbsp;&lt;A href="https://www.dynatrace.com/support/help/setup-and-configuration/setup-on-cloud-platforms/amazon-web-services/amazon-web-services-integrations/aws-lambda-integration/log-enrichment" target="_blank"&gt;AWS Lambda logs in context of traces | Dynatrace Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps get you in the right direction!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 04:41:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220547#M28021</guid>
      <dc:creator>Fin_Ubels</dc:creator>
      <dc:date>2023-08-14T04:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting log with traces using Log4J 1.x</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220549#M28022</link>
      <description>&lt;P&gt;In general - there is no way of enriching the log entries for unsupported log frameworks without modifying the application code. The approach is to retrieve the trace context information using OpenTelemetry (or OneAgent SDK which can provide that in the latest versions of the SDK) and log it along with log entries from the application.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 05:12:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Connecting-log-with-traces-using-Log4J-1-x/m-p/220549#M28022</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2023-08-14T05:12:43Z</dc:date>
    </item>
  </channel>
</rss>

