Skip to content

Commit d013c9d

Browse files
DOCSP-48005-max-log-file-count (#388)
* DOCSP-48005-max-log-file-count * edits * edits * reset duration file * review feedback
1 parent 0ecf437 commit d013c9d

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@
7171
- Directory where MongoDB Shell writes log files. Specify an
7272
absolute filepath. See :ref:`mongosh-log-location`.
7373

74+
* - ``logMaxFileCount``
75+
- integer or Infinity
76+
- 100
77+
- Maximum number of log files that the |mdb-shell| retains. After
78+
the |mdb-shell| reaches the maximum log file count, it starts
79+
deleting the oldest log files until the count is below the
80+
threshold. See :ref:`mongosh-log-file-count`.
81+
7482
* - ``logRetentionDays``
7583
- integer or Infinity
7684
- 30
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. important::
2+
3+
To prevent log storage from growing too large, always specify at
4+
least one log retention criterion.

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-file-count`
2324

2425
Details
2526
-------
@@ -30,3 +31,4 @@ Details
3031
:titlesonly:
3132

3233
Duration </logs/retention/duration>
34+
File Count </logs/retention/file-count>

source/logs/retention/file-count.txt

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.. _mongosh-log-file-count:
2+
3+
=============================
4+
Modify Maximum Log File Count
5+
=============================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
You can specify the maximum number of log files that the |mdb-shell|
14+
retains. After the |mdb-shell| reaches the maximum log file count, it
15+
starts deleting the oldest log files until the count is below the
16+
threshold.
17+
18+
The |mdb-shell| stores one log file for each session. By default, the
19+
|mdb-shell| stores up to 100 log files.
20+
21+
About this Task
22+
---------------
23+
24+
.. include:: /includes/log-retention-multiple-criteria.rst
25+
26+
Before you Begin
27+
----------------
28+
29+
To check the current maximum log file count, run the following command:
30+
31+
.. code-block:: javascript
32+
33+
config.get("logMaxFileCount")
34+
35+
Steps
36+
-----
37+
38+
To modify the maximum log file count, set the ``logMaxFileCount``
39+
configuration option. You can set configuration options in the
40+
:ref:`configuration API <configure-settings-api>` or a
41+
:ref:`configuration file <configure-settings-global>`.
42+
43+
Modify Maximum Log File Count with the Configuration API
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
46+
The following command uses the config API to set the maximum log file
47+
count to 200:
48+
49+
.. io-code-block::
50+
:copyable: true
51+
52+
.. input::
53+
:language: javascript
54+
55+
config.set("logMaxFileCount", 200)
56+
57+
.. output::
58+
:language: javascript
59+
60+
Setting "logMaxFileCount" has been changed
61+
62+
Modify Maximum Log File Count with a Configuration File
63+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64+
65+
The following configuration file sets the maximum log file count to 200:
66+
67+
.. code-block:: yaml
68+
69+
mongosh:
70+
logMaxFileCount: 200
71+
72+
Disable Maximum Log File Limit
73+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74+
75+
To disable the maximum log file limit, set ``logMaxFileCount`` to
76+
``Infinity``. You can perform this action through the config API or
77+
configuration file. For example:
78+
79+
.. code-block:: javascript
80+
81+
config.set("logMaxFileCount", Infinity)
82+
83+
.. include:: /includes/specify-one-retention-criterion.rst

0 commit comments

Comments
 (0)