08 Jun 2023 04:29 PM - last edited on 13 Jun 2023 12:25 PM by Ana_Kuzmenchuk
Hello all,
I've been following the article to enable Nginx logs enrichment and to include the DT in the Nginx logs however, I have Dynatrace implemented in one environment and it works fine but when I try to run Nginx on my local machine I get the following error:
[emerg] 1#1: unknown "dt_trace_id" variable
nginx: [emerg] unknown "dt_trace_id" variable
My config looks like this:
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;
}
Anyone can advise on how I can do Nginx logs enrichment that can work whether Dynatrace is enabled or not?
Thank you.
03 Aug 2023 08:41 PM
@ahmad were you able to solve this issue or are you still experiencing it? If it was solved, what was the underlying problem?
14 Dec 2023 02:44 PM
Is nginx instrumented locally? What version of nginx is being run? Do you have the oneagent installed?
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