NXRM Immortals Sprint 40, NXRM Immortals Sprint 41, NXRM Immortals Sprint 42, NXRM Immortals Sprint 43
Often administrators need to find which assets were deleted and why, and for this purpose, searching audit.log (and task logs) should be the correct place.
However, after migrating to External DB, audit.log does not log any deleted event by running the Cleanup service task.
- Install NXRM 3.40.1 with H2 or PostgreSQL
- Create a cleanup policy for "raw" format with ".*" asset name matcher
- Create "row-hosted" repo with above cleanup policy, then upload some file
- Run "Cleanup service" task manually.
audit/audit.log should record the "deleted" event for deleted components and assets which also includes the end user format relevant context about what actual asset was deleted ( not just some internal database id ).
Optionally, if the Cleanup service task logs the used cleanup policy detail with INFO level, that will be very helpful (NEXUS-34252)
audit/audit.log does not log any "deleted" event
NOTE: It does record "purged" with some internal ID, but this does not help administrators.
Also, repository.cleanup-20220719002142999.log does not say what was deleted
2022-07-19 00:21:43,006+0000 INFO [quartz-13-thread-19] *SYSTEM org.sonatype.nexus.cleanup.internal.content.service.CleanupServiceImpl - Deleting components in repository maven-hosted using policy clean_all 2022-07-19 00:21:43,328+0000 INFO [quartz-13-thread-19] *SYSTEM org.sonatype.nexus.cleanup.internal.content.service.CleanupServiceImpl - 5 components cleaned up for repository maven-hosted in total 2022-07-19 00:21:43,328+0000 INFO [quartz-13-thread-19] *SYSTEM org.sonatype.nexus.cleanup.internal.content.service.CleanupServiceImpl - 5 components cleaned up across all repositories 2022-07-19 00:21:43,328+0000 INFO [quartz-13-thread-19] *SYSTEM org.sonatype.nexus.cleanup.internal.task.CleanupTask - Cleanup finished 2022-07-19 00:21:43,328+0000 INFO [quartz-13-thread-19] *SYSTEM org.sonatype.nexus.cleanup.internal.task.CleanupTask - Task complete
Build a project with this branch
nexus.orient.enabled=false nexus.datastore.developer=true nexus.datastore.table.search.enabled=true nexus.search.event.handler.flushOnCount=1 nexus.search.event.handler.flushOnSeconds=1
Create a cleanup policy for "raw" format by Asset Name Matcher with ".*"
Create raw_hosted repo with your applied cleanup policy
Upload couple raw components
Chose System -> Tasks -> Cleanup service and hit Run
After a while some log files must appear in sonatype-work/nexus3/log/audit/ and sonatype-work/nexus3/log/tasks
audut.log must contain removed components in detail
- is related to
NEXUS-34252 No audit event by changing cleanup policy
NEXUS-20342 log the cleanup policy details being applied during the repository.cleanup run