Introduction
This article explains how to troubleshoot issues by correlating requests between Artifactory and Nginx (or any other reverse proxy) using a trace ID. The correlation enables users to analyze requests more effectively, simplifying the troubleshooting process.
By following the outlined steps, you can enhance your ability to track and resolve issues that may arise in your Artifactory/ Artifactory HA setup.
Resolution
Step 1- Enable the Trace ID header with a system property in file 'artifactory.system.properties', which is located under '/opt/jfrog/artifactory/var/etc/artifactory/'
artifactory.trace.id.response.header=true
With this setting, Artifactory will append the response header X-Artifactory-Trace-Id to every request.
Note:
Trace ID feature is supported from Artifactory 7.79
Step 2 - Add this header to the Nginx logs:
a) Add the following line to ‘/etc/nginx/nginx.conf’ in the log_format main section:
'"$sent_http_x_artifactory_trace_id"';
Before the change:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
' "$http_user_agent" "$http_x_forwarded_for" ';
After the change:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$sent_http_x_artifactory_trace_id"';
b) Attach the main log format to the artifactory.conf logs, under /etc/nginx/conf.d/artifactory.conf:
access_log /var/log/nginx/artifactory-access.log main;
Before the change it is usually commented and looks like this:
## access_log /var/log/nginx/artifactory-access.log timing;)
Now, requests should print the Trace ID on the Nginx access log.
Test:
To verify that everything is working correctly, run a test request using curl:
~ curl http://<artifactory>/artifactory/api/system/ping -v
…
>
< HTTP/1.1 200
…
< X-Artifactory-Trace-Id: 52f1af7a2d090732
…
<
*
OK
Traces in the artifactory-request.log (/opt/jfrog/artifactory/var/log/):
2025-04-02T19:46:45.629Z|7ba7a9f2a0c003a9|10.160.0.3|anonymous|GET|/api/system/ping|200|-1|2|18|curl/7.68.0
Nginx Access logs
<IP> - - [02/Apr/2025:19:46:45 +0000] "GET /artifactory/api/system/ping HTTP/1.1" 200 12 "-" "curl/7.68.0" "-" "7ba7a9f2a0c003a9"
Conclusion
By enabling the trace ID response header in Artifactory and updating the Nginx log configuration, you can successfully correlate requests between the two systems. This correlation is helpful for troubleshooting and identifying issues quickly. For additional assistance, please reach out to the JFrog support team.