DataDog / nginx-datadog

Enhance NGINX Observability and Security with Datadog's Module
https://www.datadoghq.com
Apache License 2.0
25 stars 10 forks source link

"Executing invalid Datadog script" errors with every request #97

Closed toadjaune closed 4 months ago

toadjaune commented 4 months ago

Description

For every request, 2 error log lines are generated, like those :

2024/07/24 12:48:07 [error] 216792#216792: *120 Executing invalid Datadog script, client: 10.2.3.178, server: , request: "GET /health/ HTTP/1.1", host: "10.2.1.156"
2024/07/24 12:48:07 [error] 216792#216792: *120 Executing invalid Datadog script while logging request, client: 10.2.3.178, server: , request: "GET /health/ HTTP/1.1", host: "10.2.1.156"

Please note that despite the presence of those logs, the traces are correctly sent.

System info

Minimal reproducing configuration

user www-data; worker_processes auto; pid /run/nginx.pid; error_log /var/log/nginx/error.log;

events { worker_connections 768; }

http { server { listen 80 default_server; listen [::]:80 default_server;

stub_status; # triggers the extraneous log lines
# return 204; # does not trigger the issue

} }


* `systemctl restart nginx`
* `curl -v localhost`
* See the error log lines in `/var/log/nginx/error.log`

I suspect that the reason why the `return` config line does not exhibit the bug is because of https://github.com/DataDog/nginx-datadog/issues/58 (they aren't traced and don't trigger this module's code)
toadjaune commented 4 months ago

After further testing, this seems to be a regression introduced by version 1.2.0 ; 1.1.0 does not exhibit the bug.

skomp commented 4 months ago

I guess this is the same issue. We receive these logs since upgrade to version 1.2.0 and 1.2.1, respectively.

2024/07/25 11:43:58 [error] 42#42: *141704 Executing invalid Datadog script while sending to client, client: 10.0.38.226, server: localhost, ...
2024/07/25 11:43:58 [error] 42#42: *141704 Condition expression for  directive at :0 evaluated to unexpected value "". Expected "on" or "off". Proceeding as if the value were "off". while sending to client

Tested on nginx 1.25.4 for 1.1.0 dd plugin, 1.26.0 for 1.1.0, 1.27.0 for dd plugin version 1.2.1.

obukhov commented 4 months ago

Observing same exact issue in version 1.2.0

kneufeld-pbp commented 4 months ago

It looks similar to my issue #94, which has been merged and will be part of the next release. In the meantime, we have built the module ourselves from the master branch, and it appears to work without issue in our pre-production environments.

toadjaune commented 4 months ago

Indeed it does. Sorry for the duplicate !