<?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 NGINX logs enrichment whether Dynatrace is enabled or not in Log Analytics</title>
    <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/214472#M280</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I've been following the &lt;A href="https://www.dynatrace.com/support/help/observe-and-explore/logs/log-monitoring/log-monitoring-configuration/log-enrichment#retrieve-span-and-trace-ids" target="_self"&gt;article&lt;/A&gt; to enable Nginx logs enrichment and to include the DT in the&amp;nbsp;Nginx logs however, I have Dynatrace implemented in one environment and it works fine but when I try to run&amp;nbsp;Nginx on my local machine I get the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[emerg] 1#1: unknown "dt_trace_id" variable
nginx: [emerg] unknown "dt_trace_id" variable
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My config looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /tmp/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  custom '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '[!dt dt.trace_id=$dt_trace_id,dt.span_id=$dt_span_id,dt.trace_sampled=$dt_trace_sampled] '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  custom;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone can advise on how I can do Nginx logs enrichment that can work whether Dynatrace is enabled or not?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2023 11:25:43 GMT</pubDate>
    <dc:creator>ahmad</dc:creator>
    <dc:date>2023-06-13T11:25:43Z</dc:date>
    <item>
      <title>NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/214472#M280</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I've been following the &lt;A href="https://www.dynatrace.com/support/help/observe-and-explore/logs/log-monitoring/log-monitoring-configuration/log-enrichment#retrieve-span-and-trace-ids" target="_self"&gt;article&lt;/A&gt; to enable Nginx logs enrichment and to include the DT in the&amp;nbsp;Nginx logs however, I have Dynatrace implemented in one environment and it works fine but when I try to run&amp;nbsp;Nginx on my local machine I get the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[emerg] 1#1: unknown "dt_trace_id" variable
nginx: [emerg] unknown "dt_trace_id" variable
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My config looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /tmp/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  custom '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '[!dt dt.trace_id=$dt_trace_id,dt.span_id=$dt_span_id,dt.trace_sampled=$dt_trace_sampled] '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  custom;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone can advise on how I can do Nginx logs enrichment that can work whether Dynatrace is enabled or not?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 11:25:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/214472#M280</guid>
      <dc:creator>ahmad</dc:creator>
      <dc:date>2023-06-13T11:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/219735#M281</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/63603"&gt;@ahmad&lt;/a&gt;&amp;nbsp;were you able to solve this issue or are you still experiencing it? If it was solved, what was the underlying problem?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 19:41:57 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/219735#M281</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-08-03T19:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/231911#M282</link>
      <description>&lt;P&gt;Is nginx instrumented locally? What version of nginx is being run? Do you have the oneagent installed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Nginx logs enrichment that can work whether Dynatrace is enabled or not? -- using this method depends on the nginx process being instrumented by the OneAgent&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 14:44:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/231911#M282</guid>
      <dc:creator>danmichael</dc:creator>
      <dc:date>2023-12-14T14:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280125#M1377</link>
      <description>&lt;P&gt;We also have dev and test environments without Dynatrace. My strategy is to run a startup script to detect if Dynatrace is instrumenting the Docker container my nginx server is running in. The script tests if the /etc/ld.so.preload is set to load the dynatrace one agent library. If it is detected then I update the logging config with the Dynatrace specific logging patterns. e.g.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# Check if the Dynatrace OneAgent is installed by checking for the presence of&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# liboneagentproc in the /etc/ld.so.preload file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;grep&lt;/SPAN&gt; &lt;SPAN&gt;-q&lt;/SPAN&gt; "&lt;SPAN&gt;liboneagentproc"&lt;/SPAN&gt; "&lt;SPAN&gt;/etc/ld.so.preload"&lt;/SPAN&gt;&lt;SPAN&gt; ; &lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;echo&lt;/SPAN&gt; &lt;SPAN&gt;"Enabling Dynatrace logging instrumentation"&lt;BR /&gt;&lt;/SPAN&gt;# Update or replace nginx.conf to insert Dynatrace pattern [!dt dt.trace_id=$dt_trace_id]&lt;BR /&gt;# into the logging config here.&lt;BR /&gt;fi&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 00:07:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280125#M1377</guid>
      <dc:creator>jasonbutler22</dc:creator>
      <dc:date>2025-06-25T00:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280133#M1380</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can try solving this by defining fallback values for the Dynatrace variables using the map directive in NGINX. This is useful when Dynatrace OneAgent is not installed (e.g., in local environments), and NGINX would otherwise throw an error due to unknown variables like $dt_trace_id.&lt;/P&gt;&lt;P&gt;map "" $dt_trace_id_safe {&lt;BR /&gt;default "-";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;map "" $dt_span_id_safe {&lt;BR /&gt;default "-";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;map "" $dt_trace_sampled_safe {&lt;BR /&gt;default "-";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;then update your log_format.&lt;/P&gt;&lt;P&gt;Radek&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 07:49:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280133#M1380</guid>
      <dc:creator>radek_jasinski</dc:creator>
      <dc:date>2025-06-25T07:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280253#M1384</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/16832"&gt;@radek_jasinski&lt;/a&gt;,&amp;nbsp;do you have a working example of this that you can share? I'd like to see where you placed that and in which file, the nginx.conf or another? I also have a need for &lt;A title="manual Nginx log enrichment" href="https://docs.dynatrace.com/docs/shortlink/log-monitoring-log-enrichment#example-of-manually-enriching-nginx-log-data" target="_blank" rel="noopener"&gt;Nginx log enrichment&lt;/A&gt;, but I get the same error as&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/63603"&gt;@ahmad&lt;/a&gt;&amp;nbsp;did.&lt;/P&gt;&lt;P&gt;I have the agent monitoring the nginx process in full stack, the OneAgent module &lt;SPAN&gt;&lt;STRONG&gt;dt_one_agent&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;shows up in the modules list.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 13:12:39 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280253#M1384</guid>
      <dc:creator>andre_vdveen</dc:creator>
      <dc:date>2025-06-26T13:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280351#M1385</link>
      <description>&lt;P class=""&gt;Yes, i will share later some example&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 11:48:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/280351#M1385</guid>
      <dc:creator>radek_jasinski</dc:creator>
      <dc:date>2025-06-27T11:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: NGINX logs enrichment whether Dynatrace is enabled or not</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/284229#M1421</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/16832"&gt;@radek_jasinski&lt;/a&gt;, are you able to share any examples? Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 21:12:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/NGINX-logs-enrichment-whether-Dynatrace-is-enabled-or-not/m-p/284229#M1421</guid>
      <dc:creator>Mo_Azuz</dc:creator>
      <dc:date>2025-08-19T21:12:06Z</dc:date>
    </item>
  </channel>
</rss>

