ARTIFACTORY: How to identify the user who performed recent upload to a specific repository

ARTIFACTORY: How to identify the user who performed recent upload to a specific repository

AuthorFullName__c
Vaibhav Jain
articleNumber
000005892
ft:sourceType
Salesforce
FirstPublishedDate
2023-10-19T15:14:33Z
lastModifiedDate
2023-10-18
VersionNumber
1

In this Knowledge Base article, we'll explore a method to identify the user who has recently performed an upload to a repository or updated an artifact. There are situations where administrators may find it valuable to ascertain who has executed deployments on the repository, particularly in relation to the latest updates. To address this, we can utilize the provided AQL query below, which aids in achieving this specific use case.
 

> curl -uadmin -X POST -k -H 'Content-Type:text/plain' -i https://<JFROG_URL>/artifactory/api/search/aql --data 'items.find({"repo": "nuget-local"}).sort({"$desc":["updated"]}).limit(1)'


{
"results" : [ {
  "repo" : "nuget-local",
  "path" : ".",
  "name" : "moq-4.20.1.tar.gz",
  "type" : "file",
  "size" : 370557,
  "created" : "2023-08-24T09:28:23.391Z",
  "created_by" : "test1",
  "modified" : "2023-09-29T04:03:35.724Z",
  "modified_by" : "test2",
  "updated" : "2023-09-29T04:03:39.525Z"
} ],
"range" : {
  "start_pos" : 0,
  "end_pos" : 1,
  "total" : 1,
  "limit" : 1
}
}

The AQL query allows for flexibility in setting limits based on individual requirements. In this case, the query is designed to display the most recent deployment in the repository. This can be achieved by sorting the data in descending order based on the update date and limiting the result to one entry.

Furthermore, it's worth noting that although the file was initially created by the user "test1," it has since been modified and deployed by user "test2." This information can be corroborated by comparing the creation and modification timestamps.


For more information on AQL, please refer to the below articles:

1. jfrog-rest-apis/artifactory-query-language-aql 
2. artifactory-query-language