- Reference >
- Database Commands >
- Diagnostic Commands >
- getLog
getLog¶
-
getLog¶ The
getLogcommand returns a document with alogarray that contains recent messages from themongodprocess log. ThegetLogcommand has the following syntax:Replace
<log>with one of the following values:global- returns the combined output of all recent log entries.rs- if themongodis part of a replica set,getLogwill return recent notices related to replica set activity.startupWarnings- will return logs that may contain errors or warnings from MongoDB’s log from when the current process started. Ifmongodstarted without warnings, this filter may return an empty array.
You may also specify an asterisk (e.g.
*) as the<log>value to return a list of available log filters. The following interaction from themongoshell connected to a replica set:getLogreturns events from a RAM cache of themongodevents and does not read log data from the log file.