Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions source/includes/list-table-shell-properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
specify at least one log retention criterion. See
:ref:`mongosh-logs-retention`.

* - ``logRetentionGB``
- float or Infinity
- Unset
- Maximum amount of space in gigabytes used for |mdb-shell| logs.
If the combined size of |mdb-shell| logs exceeds this value, log
files are deleted starting with the oldest logs.

If this value is set to ``Infinity``, log files are not deleted
based on storage size. To prevent log storage from growing too
large, always specify at least one log retention criterion. See
:ref:`mongosh-logs-retention`.

* - ``redactHistory``
- string
- ``remove``
Expand Down
2 changes: 2 additions & 0 deletions source/logs/retention.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Get Started
To customize log retention, see these pages:

- :ref:`mongosh-log-file-duration`
- :ref:`mongosh-log-retention-gb`
- :ref:`mongosh-log-file-count`

Details
Expand All @@ -31,4 +32,5 @@ Details
:titlesonly:

Duration </logs/retention/duration>
Storage Size </logs/retention/size>
File Count </logs/retention/file-count>
15 changes: 11 additions & 4 deletions source/logs/retention/duration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Modify Log Retention Duration
=============================

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol

You can modify how long |mdb-shell| log files are retained. A log
cleanup process automatically deletes log files older than the specified
retention period. By default, log files are retained for 30 days.
Expand Down Expand Up @@ -64,9 +70,10 @@ Disable Duration-Based Log Cleanup

To instruct |mdb-shell| to not delete logs based on file age, set
``logRetentionDays`` to ``Infinity``. You can perform this action
through the config API or configuration file.
through the config API or configuration file. For example:

.. code-block:: javascript

.. important::
config.set("logRetentionDays", Infinity)

To prevent log storage from growing too large, always specify at
least one log retention criterion.
.. include:: /includes/specify-one-retention-criterion.rst
95 changes: 95 additions & 0 deletions source/logs/retention/size.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.. _mongosh-log-retention-gb:

===============================
Modify Maximum Log Storage Size
===============================

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol

You can specify a maximum combined storage size for |mdb-shell| log
files. If the total size of all log files exceeds the maximum, log files
are deleted until the combined size is below the threshold, starting
with the oldest log files. By default, there is no maximum log storage
size.

About this Task
---------------

To specify a maximum log storage size, set the ``logRetentionGB``
configuration option. ``logRetentionGB`` can be any positive float
value (including less than ``1``).

.. include:: /includes/log-retention-multiple-criteria.rst

To check the current storage size of log files, check the size of the
log folder. To see the current log folder, run the following command
from the |mdb-shell|:

.. code-block:: javascript

config.get('logLocation')

Before you Begin
----------------

To check the current maximum log storage size, run the following
command:

.. code-block:: javascript

config.get("logRetentionGB")

Steps
-----

To modify maximum log storage size, set the ``logRetentionGB``
configuration option. You can set configuration options in the
:ref:`configuration API <configure-settings-api>` or a
:ref:`configuration file <configure-settings-global>`.

Modify Maximum Log Storage Size with the API
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following command uses the config API to set the maximum log storage
size to 3.5 GB:

.. io-code-block::
:copyable: true

.. input::
:language: javascript

config.set("logRetentionGB", 3.5)

.. output::
:language: javascript

Setting "logRetentionGB" has been changed

Modify Maximum Log Storage Size with a Configuration File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following configuration file sets the maximum log storage size to
3.5 GB:

.. code-block:: yaml

mongosh:
logRetentionGB: 3.5

Disable Maximum Log Storage Size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To instruct the |mdb-shell| to not delete logs based on storage size,
set ``logRetentionGB`` to ``Infinity``. You can perform this action
through the config API or configuration file. For example:

.. code-block:: javascript

config.set("logRetentionGB", Infinity)

.. include:: /includes/specify-one-retention-criterion.rst