How to trace what has uploaded to nexus3 - Sonatype Nexus Repository - Sonatype Community

How to trace what has uploaded to nexus3

post by sameer29nov on Sep 25, 2024

Hello There,

We are using nexus 3.69 , we want to investigate what has been uploaded on day so that we can verify and remove unwanted artifacts.

Use case : to check data uploaded on nexus on specific date (example Yesterday)

Any way from UI ?

Any way from command line ?

Any way from orientdb ?

I have this script but it will take time to get data

#!/bin/bash

# Configuration
REPO="YOUR_REPOSITORY_NAME"
NEXUS_URL="http://YOUR_NEXUS_SERVER/service/rest/v1/components?repository=$REPO"
OUTPUT_FILE="components.json"

# Fetch data from Nexus
curl -u YOUR_USERNAME:YOUR_PASSWORD "$NEXUS_URL" -o "$OUTPUT_FILE"

# Get yesterday’s date in the required format
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)

# Filter components created yesterday
echo "Components uploaded on $YESTERDAY:"
jq --arg date "$YESTERDAY" '
.items | select(.created | startswith($date)) | {name: .name, version: .version, created: .created}
' "$OUTPUT_FILE"

Please guide,

Regards,

SAM

post by mprescott on Sep 25, 2024

Not a direct answer to your question, but are you aware of cleanup policies? I’m curious what process or criterion you’ll use to decide whether to keep or delete an artifact. Are you getting a month’s worth of uploads and then comparing them with some other data source? (If so, what, and what does it tell you?)

post by sameer29nov on Sep 26, 2024

@mprescott Thank you for response, we found the way and working on clean up policies

post by mpiggott on Sep 26, 2024

You could also take a look at the audit log which would contain information about new or updated assets.