发布于 2015-09-14 14:59:38 | 168 次阅读 | 评论: 0 | 来源: 网络整理

getLog

The getLog command returns a document with a log array that contains recent messages from the mongod process log. The getLog command has the following syntax:

{ getLog: <log> }

Replace <log> with one of the following values:

  • global - returns the combined output of all recent log entries.
  • rs - if the mongod 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. If mongod 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 the mongo shell connected to a replica set:

db.adminCommand({getLog: "*" })
{ "names" : [ "global", "rs", "startupWarnings" ], "ok" : 1 }

getLog returns events from a RAM cache of the mongod events and does not read log data from the log file.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务