Introduction
Administrators and developers often need to audit metadata changes in Artifactory. Sometimes, you may want to identify artifacts whose properties (metadata/tags) have changed recently—such as in the last 24 hours—even if the actual binary file itself has not been modified or redeployed.
This article will demonstrate how to use Artifactory Query Language (AQL) to manually query for recent property modifications. Additionally, it covers how to use JFrog Workers to automatically intercept and react to property changes in real-time.
Resolution
You can handle property tracking in two ways: reactively searching for past changes using AQL, or proactively acting on new changes using JFrog Workers.
Method 1: Querying Past Changes with AQL
To identify artifacts based solely on when their properties were last updated, you must query the Item info domain fields rather than standard creation or modification dates (which track the physical binary).
1. Construct the AQL Query Use the following query, replacing "repo-name" with your target repository:
items.find({
"repo": {"$match": "repo-name"},
"props_modified": {"$last": "1d"}
}).include(
"repo",
"path",
"name",
"props_modified",
"props_modified_by",
"property"
)
2. Understand the Query Components
-
"props_modified": {"$last": "1d"}: This restricts the search to items where the properties were changed within the last 1 day (24 hours).
-
"props_modified" (Include field): Displays the exact timestamp of when the property was updated.
-
"props_modified_by" (Include field): Displays the username or service account that made the change.
-
"property" (Include field): Outputs the current list of properties attached to the artifact.
Method 2: Automating Real-Time Tracking with JFrog Workers
If querying after the fact is not sufficient and you need to take immediate action the moment a property is added or modified (e.g., sending a webhook notification, validating the property value, or blocking unauthorized tags), you can use JFrog Workers.
Workers allow you to write custom serverless scripts that trigger on specific Artifactory events.
-
To intercept a property change before it is saved to the database, you can utilize the beforeCreateProperty execution phase.
-
To see a practical example of how to implement this script, please refer to the Before Create Property Worker Code Sample in our official documentation.
Conclusion
By leveraging the props_modified field within an AQL query, you can easily audit historical metadata updates across your repositories. For teams requiring strict governance or real-time automation, JFrog Workers provide the ability to intercept property changes the exact moment they happen.
For a complete list of fields available for querying, please refer to the official JFrog documentation on AQL Item Info Domain Fields.