Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-34184

log in audit.log components deleted by Cleanup service task

    Details

    • Story Points:
      5
    • Sprint:
      NXRM Immortals Sprint 40, NXRM Immortals Sprint 41, NXRM Immortals Sprint 42, NXRM Immortals Sprint 43
    • Notability:
      2
    • InvestmentLayer:
      support-escalated

      Description

      ISSUE:

      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.

      REPRODUCE STEPS:

      1. Install NXRM 3.40.1 with H2 or PostgreSQL
      2. Create a cleanup policy for "raw" format with ".*" asset name matcher
      3. Create "row-hosted" repo with above cleanup policy, then upload some file
      4. Run "Cleanup service" task manually.

      EXPECTED

      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)

      ACTUAL BEHAVIOUR:

      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
      

      TEST INSTRUCTIONS

      Build a project with this branch
      Configure options:

      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

        Attachments

        1. audit.log
          15 kB
        2. audit-1.log
          41 kB
        3. repository.cleanup-20220919130810958.log
          3 kB
        4. screenshot-1.png
          screenshot-1.png
          87 kB

          Issue Links

            Activity

              People

              Assignee:
              ybulatnikov Eugene Bulatnikov
              Reporter:
              hosako Hajime Osako
              Last Updated By:
              Eugene Bulatnikov Eugene Bulatnikov
              Team:
              NXRM - Optimus
              Owner:
              Eugene Bulatnikov Eugene Bulatnikov
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title