Docs Menu
Docs Home
/
MongoDB Shell
/ /

Enable Log Compression

On this page

  • About this Task
  • Before you Begin
  • Steps

You can enable compression for MongoDB Shell log files. By default, MongoDB Shell does not compress log files.

When log compression is enabled, MongoDB Shell compresses log files with gzip.

After you toggle log compression, you must start a new MongoDB Shell session for the change to take effect.

To check if log compression is enabled, run the following command from MongoDB Shell:

config.get("logCompressionEnabled")

To enable log compression, set the logCompressionEnabled configuration option to true. You can set configuration options in the configuration API or a configuration file.

The following command uses the config API to enable log compression:

config.set("logCompressionEnabled", true)
Setting "logCompressionEnabled" has been changed

The following configuration file enables log compression:

mongosh:
logCompressionEnabled: true

To disable log compression, set logCompressionEnabled to false. You can perform this action through the config API or configuration file.

Back

File Count