Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-31383

Fix audit entries for rendition when audit is stored in MongoDB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 10.10-HF65, 2021.25
    • Fix Version/s: 10.10-HF68, 2023.0, 2021.29
    • Component/s: Rest API
    • Release Notes Summary:
      Rendition download events are correctly saved to MongoDB audit
    • Backlog priority:
      1,000
    • Sprint:
      nxplatform #74

      Description

      Steps to reproduce:

      1. configure the audit in MongoDB with
        nuxeo.templates=mongodb,mongodb-audit
        
      2. start Nuxeo
      3. log in as Administrator
      4. go to the personal workspace
      5. create a File document with a .docx file
      6. observe that the document is created and a preview is displayed
      7. in the logs, there will be a warning like
        2022-11-07T10:39:07,241 WARN  [audit/writerPool-00,in:3,inCheckpoint:2,out:0,lastRead:1667813945633,lastTimer:1667813945616,wm:218603709448716289,loop:990,record] [org.nuxeo.lib.stream.computation.AbstractBatchComputation] Computation: audit/writer fails to process batch of 1 records, last record: audit-audit-00:+82905753714690, retrying ...
        java.lang.IllegalArgumentException: Invalid BSON field name nuxeo.download.rendition
                at org.bson.AbstractBsonWriter.writeName(AbstractBsonWriter.java:534) ~[bson-4.1.1.jar:?]
                at com.mongodb.internal.connection.BsonWriterDecorator.writeName(BsonWriterDecorator.java:193) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.IdHoldingBsonWriter.writeName(IdHoldingBsonWriter.java:302) ~[mongodb-driver-core-4.1.1.jar:?]
                at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:216) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:200) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:217) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:159) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:46) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) ~[bson-4.1.1.jar:?]
                at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:200) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:187) ~[mongodb-driver-core-4.1.1.jar:?]
                at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) ~[bson-4.1.1.jar:?]
                at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) ~[bson-4.1.1.jar:?]
                at com.mongodb.internal.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:77) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:59) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:162) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:138) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:59) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:269) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:100) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:490) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:255) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:202) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:118) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:431) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:251) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation.access$700(MixedBulkWriteOperation.java:76) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:194) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:185) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.OperationHelper.withReleasableConnection(OperationHelper.java:620) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:185) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:76) ~[mongodb-driver-core-4.1.1.jar:?]
                at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:195) ~[mongodb-driver-sync-4.1.1.jar:?]
                at com.mongodb.client.internal.MongoCollectionImpl.executeInsertMany(MongoCollectionImpl.java:498) ~[mongodb-driver-sync-4.1.1.jar:?]
                at com.mongodb.client.internal.MongoCollectionImpl.insertMany(MongoCollectionImpl.java:480) ~[mongodb-driver-sync-4.1.1.jar:?]
                at com.mongodb.client.internal.MongoCollectionImpl.insertMany(MongoCollectionImpl.java:475) ~[mongodb-driver-sync-4.1.1.jar:?]
                at org.nuxeo.mongodb.audit.MongoDBAuditBackend.addLogEntries(MongoDBAuditBackend.java:354) ~[nuxeo-platform-audit-mongodb-2021.5.4.jar:?]
                at org.nuxeo.ecm.platform.audit.impl.StreamAuditWriter$AuditLogWriterComputation.writeEntriesToAudit(StreamAuditWriter.java:96) ~[nuxeo-platform-audit-core-2021.22.4.jar:?]
                at org.nuxeo.ecm.platform.audit.impl.StreamAuditWriter$AuditLogWriterComputation.batchProcess(StreamAuditWriter.java:80) ~[nuxeo-platform-audit-core-2021.22.4.jar:?]
        

      It seems that a BSON entry cannot have a name like "nuxeo.download.rendition". And it may be a known issue as a specific key for the extended infos exists for "rendition" : https://github.com/nuxeo/nuxeo/blob/2021/modules/core/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/download/DownloadService.java#L85whereas the REST API uses another key https://github.com/nuxeo/nuxeo-lts/blob/v2021.25/modules/platform/rest-api/nuxeo-rest-api-server/src/main/java/org/nuxeo/ecm/restapi/server/jaxrs/rendition/RenditionObject.java#L89

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: