Docs Home / mongosh / Reference

Shell Logs

The MongoDB Shell stores a log for each session. The log contains a record of commands run, server connections, and other useful information about actions performed in the MongoDB Shell.MongoDB Shell为每个会话存储一个日志。日志包含运行的命令、服务器连接以及有关在MongoDB Shell中执行的操作的其他有用信息的记录。

Get Started开始使用

You can view or tail the logs for a MongoDB Shell session based on its log ID.您可以根据MongoDB Shell会话的日志ID查看或跟踪其日志。

To learn how to view and customize MongoDB Shell logs, see these pages:要了解如何查看和自定义MongoDB Shell日志,请参阅以下页面:

Details详情

See the following details about MongoDB Shell logging behavior:请参阅以下有关MongoDB Shell日志记录行为的详细信息:

Format格式

The MongoDB Shell uses Newline delimited JSON to store session logs, which is the same log format used for MongoDB server logs.MongoDB Shell使用换行符分隔的JSON来存储会话日志,这与MongoDB服务器日志使用的日志格式相同。

Redaction补救措施

The MongoDB Shell redacts credentials from the command history and the logs.MongoDB Shell从命令历史日志中编辑凭据。

Retention留存

By default, the MongoDB Shell retains up to 100 log files, and individual log files are retained for 30 days. To customize log file retention, see Log Retention.默认情况下,MongoDB Shell最多保留100个日志文件,单个日志文件保留30天。要自定义日志文件保留,请参阅日志保留