Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to enable audit logging in MongoDB configuration.
MongoDB
auditLog:
destination: [1] Drag options to blanks, or click blank then click option'
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.
✗ Incorrect
Setting 'destination' to 'file' enables audit logs to be saved to a file on disk.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The path '/var/log/mongodb/audit.log' is the standard location for MongoDB audit logs.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes inside single quotes causes syntax errors.
Not quoting the string value causes invalid JSON.
✗ Incorrect
The filter value must be a string with double quotes inside the single quotes to be valid JSON.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using event types unrelated to authentication events.
Not quoting event names properly.
✗ Incorrect
The filter uses $or to include both 'authenticate' and 'authCheck' event types.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter' instead of 'format' to set the log format.
Not quoting the path string properly.
✗ Incorrect
The 'format' field sets the log format to JSON, 'file' sets the destination, and the path specifies the log file location.