Skip to content

Commit cb71e8a

Browse files
DOCSP-47980-log-storage-size (#387)
* DOCSP-47935-log-retention-duration * add duration page to toc * WIP * edit * edit * wording * edit * edit * edit * wording * retry build * DOCSP-47935-log-storage-size * add setting to table * wording * fix conflict * edit * add text * wording
1 parent d013c9d commit cb71e8a

File tree

4 files changed

+120
-4
lines changed

4 files changed

+120
-4
lines changed

source/includes/list-table-shell-properties.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@
8888
specify at least one log retention criterion. See
8989
:ref:`mongosh-logs-retention`.
9090

91+
* - ``logRetentionGB``
92+
- float or Infinity
93+
- Unset
94+
- Maximum amount of space in gigabytes used for |mdb-shell| logs.
95+
If the combined size of |mdb-shell| logs exceeds this value, log
96+
files are deleted starting with the oldest logs.
97+
98+
If this value is set to ``Infinity``, log files are not deleted
99+
based on storage size. To prevent log storage from growing too
100+
large, always specify at least one log retention criterion. See
101+
:ref:`mongosh-logs-retention`.
102+
91103
* - ``redactHistory``
92104
- string
93105
- ``remove``

source/logs/retention.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Get Started
2020
To customize log retention, see these pages:
2121

2222
- :ref:`mongosh-log-file-duration`
23+
- :ref:`mongosh-log-retention-gb`
2324
- :ref:`mongosh-log-file-count`
2425

2526
Details
@@ -31,4 +32,5 @@ Details
3132
:titlesonly:
3233

3334
Duration </logs/retention/duration>
35+
Storage Size </logs/retention/size>
3436
File Count </logs/retention/file-count>

source/logs/retention/duration.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
Modify Log Retention Duration
55
=============================
66

7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
713
You can modify how long |mdb-shell| log files are retained. A log
814
cleanup process automatically deletes log files older than the specified
915
retention period. By default, log files are retained for 30 days.
@@ -64,9 +70,10 @@ Disable Duration-Based Log Cleanup
6470

6571
To instruct |mdb-shell| to not delete logs based on file age, set
6672
``logRetentionDays`` to ``Infinity``. You can perform this action
67-
through the config API or configuration file.
73+
through the config API or configuration file. For example:
74+
75+
.. code-block:: javascript
6876

69-
.. important::
77+
config.set("logRetentionDays", Infinity)
7078

71-
To prevent log storage from growing too large, always specify at
72-
least one log retention criterion.
79+
.. include:: /includes/specify-one-retention-criterion.rst

source/logs/retention/size.txt

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.. _mongosh-log-retention-gb:
2+
3+
===============================
4+
Modify Maximum Log Storage Size
5+
===============================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
You can specify a maximum combined storage size for |mdb-shell| log
14+
files. If the total size of all log files exceeds the maximum, log files
15+
are deleted until the combined size is below the threshold, starting
16+
with the oldest log files. By default, there is no maximum log storage
17+
size.
18+
19+
About this Task
20+
---------------
21+
22+
To specify a maximum log storage size, set the ``logRetentionGB``
23+
configuration option. ``logRetentionGB`` can be any positive float
24+
value (including less than ``1``).
25+
26+
.. include:: /includes/log-retention-multiple-criteria.rst
27+
28+
To check the current storage size of log files, check the size of the
29+
log folder. To see the current log folder, run the following command
30+
from the |mdb-shell|:
31+
32+
.. code-block:: javascript
33+
34+
config.get('logLocation')
35+
36+
Before you Begin
37+
----------------
38+
39+
To check the current maximum log storage size, run the following
40+
command:
41+
42+
.. code-block:: javascript
43+
44+
config.get("logRetentionGB")
45+
46+
Steps
47+
-----
48+
49+
To modify maximum log storage size, set the ``logRetentionGB``
50+
configuration option. You can set configuration options in the
51+
:ref:`configuration API <configure-settings-api>` or a
52+
:ref:`configuration file <configure-settings-global>`.
53+
54+
Modify Maximum Log Storage Size with the API
55+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56+
57+
The following command uses the config API to set the maximum log storage
58+
size to 3.5 GB:
59+
60+
.. io-code-block::
61+
:copyable: true
62+
63+
.. input::
64+
:language: javascript
65+
66+
config.set("logRetentionGB", 3.5)
67+
68+
.. output::
69+
:language: javascript
70+
71+
Setting "logRetentionGB" has been changed
72+
73+
Modify Maximum Log Storage Size with a Configuration File
74+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
The following configuration file sets the maximum log storage size to
77+
3.5 GB:
78+
79+
.. code-block:: yaml
80+
81+
mongosh:
82+
logRetentionGB: 3.5
83+
84+
Disable Maximum Log Storage Size
85+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86+
87+
To instruct the |mdb-shell| to not delete logs based on storage size,
88+
set ``logRetentionGB`` to ``Infinity``. You can perform this action
89+
through the config API or configuration file. For example:
90+
91+
.. code-block:: javascript
92+
93+
config.set("logRetentionGB", Infinity)
94+
95+
.. include:: /includes/specify-one-retention-criterion.rst

0 commit comments

Comments
 (0)