Reputation: 11
I'm trying to view what repos are taking up the most storage space in artifactory by using the below API call, but I can't find a way to order them. I also seen in Jfrogs documentation that you cant sort based on properties. Any suggestions as to how do to do this?
Upvotes: 1
Views: 973
Reputation: 11045
In this case, jq
is your friend!
Pipe the output of the API to a jq
with using the sort_by()
functions.
Example:
curl -s -uadmin:password https://server/artifactory/api/storageinfo | jq '[.repositoriesSummaryList[] | {repoKey: .repoKey, itemsCount: .itemsCount, usedSpaceInBytes: .usedSpaceInBytes}] | sort_by(.usedSpaceInBytes)'
You can play around with the options.
Look for more details on the jq
sorting in this good jq sorting doc.
Upvotes: 4