0
0
MongoDBquery~10 mins

Audit logging basics in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable audit logging in MongoDB configuration.

MongoDB
auditLog:
  destination: [1]
Drag options to blanks, or click blank then click option'
Afile
Bconsole
Cdatabase
Dnetwork
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'console' will only print logs to the terminal, not save them.
Using 'database' or 'network' are not valid audit log destinations.
2fill in blank
medium

Complete the code to specify the audit log file path.

MongoDB
auditLog:
  destination: file
  path: [1]
Drag options to blanks, or click blank then click option'
A/home/user/logs
B/etc/mongodb.conf
C/var/log/mongodb/audit.log
D/tmp/mongo.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using config file paths instead of log file paths.
Choosing temporary or user home directories which are not standard.
3fill in blank
hard

Fix the error in the audit filter expression to log only authorization events.

MongoDB
auditLog:
  filter: '{ atype: [1] }'
Drag options to blanks, or click blank then click option'
A'authCheck'
BauthCheck
C"authentication"
D"authCheck"
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes inside single quotes causes syntax errors.
Not quoting the string value causes invalid JSON.
4fill in blank
hard

Fill both blanks to configure audit logging for authentication and authorization events.

MongoDB
auditLog:
  filter: '{ $or: [ { atype: [1] }, { atype: [2] } ] }'
Drag options to blanks, or click blank then click option'
A"authCheck"
B"authenticate"
D"userChange"
Attempts:
3 left
💡 Hint
Common Mistakes
Using event types unrelated to authentication events.
Not quoting event names properly.
5fill in blank
hard

Fill all three blanks to enable audit logging, set destination, and specify the log path.

MongoDB
auditLog:
  [1]: JSON
  destination: [2]
  path: [3]
Drag options to blanks, or click blank then click option'
Aformat
Bfile
C"/var/log/mongodb/audit.log"
Dfilter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter' instead of 'format' to set the log format.
Not quoting the path string properly.