- Reference >
- Database Commands >
- Diagnostic Commands >
- getLog
getLog¶
-
getLog
¶ The
getLog
command returns a document with alog
array that contains recent messages from themongod
process log. ThegetLog
command has the following syntax:Replace
<log>
with one of the following values:global
- returns the combined output of all recent log entries.rs
- if themongod
is part of a replica set,getLog
will 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. Ifmongod
started 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 themongo
shell connected to a replica set:getLog
returns events from a RAM cache of themongod
events and does not read log data from the log file.