0
0
MongoDBquery~20 mins

Audit logging basics in MongoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MongoDB Audit Logging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
MongoDB Audit Log Enablement Command Output
You run the following command to enable audit logging in MongoDB:
db.adminCommand({ setParameter: 1, auditAuthorizationSuccess: true })
What is the expected output of this command?
MongoDB
db.adminCommand({ setParameter: 1, auditAuthorizationSuccess: true })
A{ "ok" : 1, "auditAuthorizationSuccess" : true }
B{ "ok" : 0, "errmsg" : "Invalid parameter" }
C{ "ok" : 1 }
DSyntaxError: Unexpected token
Attempts:
2 left
💡 Hint
The command returns a simple status object indicating success or failure.
🧠 Conceptual
intermediate
1:00remaining
Purpose of MongoDB Audit Logging
What is the primary purpose of enabling audit logging in MongoDB?
ATo record detailed information about database operations for security and compliance
BTo encrypt data stored in the database
CTo automatically backup the database at regular intervals
DTo improve database query performance by caching results
Attempts:
2 left
💡 Hint
Think about why organizations track user actions and system events.
Configuration
advanced
2:00remaining
Correct Audit Log Configuration in mongod.conf
Which of the following is the correct snippet to enable audit logging in the mongod.conf file with JSON format and output to a file named audit.log?
A
auditLog:
  destination: file
  format: JSON
  filePath: /var/log/mongodb/audit.log
B
auditLog:
  destination: file
  format: JSON
  path: /var/log/mongodb/audit.log
C
auditLog:
  destination: syslog
  format: BSON
  path: /var/log/mongodb/audit.log
D
auditLog:
  destination: file
  format: BSON
  path: /var/log/mongodb/audit.log
Attempts:
2 left
💡 Hint
Check the exact keys and values required by MongoDB for auditLog configuration.
Troubleshoot
advanced
1:30remaining
Audit Log Not Created After Configuration
After configuring audit logging in mongod.conf and restarting MongoDB, no audit log file is created. Which is the most likely cause?
AThe mongod.conf file syntax is invalid and MongoDB failed to start
BAudit logging is disabled by default and cannot be enabled
CThe audit log format is set to XML which MongoDB does not support
DThe MongoDB user does not have write permission to the audit log directory
Attempts:
2 left
💡 Hint
Think about file system permissions and user rights.
Best Practice
expert
2:00remaining
Best Practice for Managing MongoDB Audit Logs in Production
Which of the following is the best practice for managing MongoDB audit logs in a production environment?
ARotate audit logs regularly and store them securely with restricted access
BKeep audit logs indefinitely on the same disk without rotation
CDisable audit logging during peak hours to improve performance
DStore audit logs in the same directory as the database data files
Attempts:
2 left
💡 Hint
Consider security and disk space management.