Lesson 4: Logging Basics for MongoDB Servers / Learn
Code Summary: Logging Basics for MongoDB Servers
Review the following code, which demonstrates how to access the log file and logs in mongosh.
Use the File Path to Access the Log File
From the MongoDB Shell, run the following command to return the file path for the log file:
db.serverCmdLineOpts().parsed.systemLog.path
Access Logs in mongosh
To display a list of accessible tag names, use:
show logs
To display all log entries associated with a tag name or type, use:
show log <type>
To display the combined output of all recent log entries, use:
show log global