[DOCS-16367] [SERVER] Audit Filter example does not work as displayed for findAndModify() Created: 06/Sep/23  Updated: 30/Oct/23  Resolved: 07/Sep/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Critical - P2
Reporter: Zynon Putney Assignee: Lauren Tran
Resolution: Done Votes: 0
Labels: bugfix, quick-win
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 21 weeks, 6 days ago

 Description   

Audit Filter examples on the following page, if they are copy pasted into a MongoDB configuration, will not produce the desired results for `findAndModify()` operations. If a customer copy pastes these examples into their environment and tests, they will not be successful.

https://www.mongodb.com/docs/v5.0/tutorial/configure-audit-filters/#filter-on-read-and-write-operations

  • For all examples, where it is currently "findandmodify", needs to be changed to "findAndModify" for it to work. I found 6 examples on that page that need to be changed. 

 

Please see updated examples with the correct case sensitivity:

{    atype: "authCheck",    "param.command": \{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}

 

mongod --dbpath data/db --auth --setParameter auditAuthorizationSuccess=true --auditDestination file --auditFilter '{ atype: "authCheck", "param.command":

{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}' --auditFormat BSON --auditPath data/db/auditLog.bson

 
storage:
   dbPath: data/db
security:
   authorization: enabled
auditLog:
   destination: file
   format: BSON
   path: data/db/auditLog.bson
   filter: '{ atype: "authCheck", "param.command":

{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}'
setParameter: { auditAuthorizationSuccess: true }
 

{     atype: "authCheck",     "param.ns": "test.orders",     "param.command": \{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}
 
mongod --dbpath data/db --auth --setParameter auditAuthorizationSuccess=true --auditDestination file --auditFilter '{ atype: "authCheck", "param.ns": "test.orders", "param.command":

{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}' --auditFormat BSON --auditPath data/db/auditLog.bson
 
storage:
   dbPath: data/db
security:
   authorization: enabled
auditLog:
   destination: file
   format: BSON
   path: data/db/auditLog.bson
   filter: '{ atype: "authCheck", "param.ns": "test.orders", "param.command":

{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

}'
setParameter: { auditAuthorizationSuccess: true }



 Comments   
Comment by Lauren Tran [ 07/Sep/23 ]

https://github.com/10gen/docs-mongodb-internal/pull/4501

Generated at Thu Feb 08 08:15:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.