ARTIFACTORY: How to add Trace ID as Headers for Improved Traceability

ARTIFACTORY: How to add Trace ID as Headers for Improved Traceability

Products
Frog_Artifactory
Content Type
Administration_Platform
AuthorFullName__c
Shivani Budhodi
articleNumber
000006480
FirstPublishedDate
2025-06-23T09:21:28Z
lastModifiedDate
2025-06-22
VersionNumber
1
Overview:
 
This guide covers the steps to enable the Trace ID header in Artifactory and utilize it for tracking logs and troubleshooting issues. Enhancing traceability is essential for effective request monitoring and debugging. Starting from Artifactory version 7.79, a response header can be added to each request to improve traceability. Additionally, configuring this header in Nginx or other proxy servers helps diagnose and resolve issues between integrated applications.  

It is important to note that this header can be applied to any request reaching Artifactory, ensuring comprehensive request tracking and analysis.


Enabling the Trace ID Header:

To enable the Trace ID response header in Artifactory, a system property must be configured. This allows each request to include a unique identifier, improving traceability and helping in debugging across different application layers.

Add the following system property to enable the Trace ID header:
artifactory.trace.id.response.header=true

 

This property should be added to the artifactory.system.properties file, located at $JFROG_HOME/artifactory/var/etc/artifactory/artifactory.system.properties

Note
Any modification to system properties requires an Artifactory restart for the changes to take effect
Once this property is enabled, Artifactory will include the following response header in every request:
X-Artifactory-Trace-Id
Example Usage:
Executing a GET request to retrieve repository details. The REST API  will now include the X-Artifactory-Trace-Id header in the response as highlighted below.
curl -X GET -uadmin:"<PASSWORD>" "http://server.jfrog.io/artifactory/api/repositories/example-repo-local" -v

* processing: http://server.jfrog.io/artifactory/api/repositories/example-repo-local
*   Trying XXX:XXX...
* Connected to mill.jfrog.info (100.XX.X.XX) port XX
* Server auth using Basic with user 'admin'
> GET /artifactory/api/repositories/example-repo-local HTTP/1.1
> Host: server.jfrog.io
> Authorization: Basic YWRxxxxxdvcmQxKg==
> User-Agent: curl/8.2.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: no-store
< Content-Type: application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json
< Date: Thu, 20 Feb 2025 16:28:34 GMT
< X-Artifactory-Id: 64ccaf1eaa9a3f2e:71636923:195242e9566:-8000
< X-Artifactory-Node-Id: df5cfc2c33ed
< X-Artifactory-Trace-Id: 21618823333e87bb
< X-Jfrog-Version: Artifactory/7.104.6 80406900
< Transfer-Encoding: chunked
<
{
  "key" : "example-repo-local",
  "packageType" : "generic",
  "description" : "Example artifactory repository",
  "notes" : "",
  "includesPattern" : "",
  "excludesPattern" : "",
  "repoLayoutRef" : "simple-default",
  "signedUrlTtl" : 90,
  "enableComposerSupport" : false,
  "enableNuGetSupport" : false,
  "enableGemsSupport" : false,
  "enableNpmSupport" : false,
  "enableBowerSupport" : false,
  "enableChefSupport" : false,
  "enableCocoaPodsSupport" : false,
.
.
}
User-added image 

Referencing Artifactory Logs Using Trace ID:  

Once the Trace ID header is enabled, we can use the generated Trace ID to locate relevant entries in the Artifactory logs. 

Refer to the screenshot below for an example of how the Trace ID appears in the logs.

User-added image 

Conclusion:

By following the steps outlined above, we have successfully enabled the Trace ID header for requests reaching Artifactory, enhancing traceability and improving request tracking.