Skip to content

Commit 8f9cf38

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-33410-log-rotation-backport-v5.0 (BACKPORT) (#5024)
* DOCSP-33410-log-rotation-backport-v5.0 * DOCSP-33410-log-rotation-backport-v5.0 * DOCSP-33410-log-rotation-backport-v5.0 --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 09870ed commit 8f9cf38

File tree

1 file changed

+48
-45
lines changed

1 file changed

+48
-45
lines changed

source/reference/command/logRotate.txt

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,54 @@ Definition
2020
prevent a single logfile from consuming too much disk space.
2121

2222
You must issue the :dbcommand:`logRotate` command against the
23-
:term:`admin database` in the form:
23+
:term:`admin database` using the following syntax:
2424

2525
.. code-block:: javascript
26-
27-
db.adminCommand({logRotate: <target>})
28-
29-
The :dbcommand:`logRotate` command takes the following parameters:
30-
31-
.. list-table::
32-
:header-rows: 1
33-
:widths: 20 20 80
34-
35-
* - Parameter
36-
37-
- Type
38-
39-
- Description
40-
41-
* - ``<target>``
42-
43-
- string
44-
45-
- The log or logs to rotate, according to the following:
46-
47-
- ``1`` -- Rotates both the server and audit logs
48-
- ``server`` -- Rotates only the server log
49-
- ``audit`` -- Rotates only the audit log
50-
51-
* - ``comment``
52-
53-
- any
54-
55-
- *optional* A message logged by the server to the log file and
56-
audit file at time of log rotation.
57-
58-
You may also rotate the logs by sending a ``SIGUSR1`` signal to the
59-
:binary:`~bin.mongod` process.
60-
61-
For example, if a running :binary:`~bin.mongod` instance has a
62-
process ID (PID) of ``2200``, the following command rotates the log
63-
file for that instance on Linux:
64-
65-
.. code-block:: bash
66-
67-
kill -SIGUSR1 2200
26+
:copyable: false
27+
28+
db.adminCommand(
29+
{
30+
logRotate: <integer or string>,
31+
comment: <string>
32+
}
33+
)
34+
35+
Command Fields
36+
--------------
37+
38+
The command takes the following fields:
39+
40+
.. list-table::
41+
:header-rows: 1
42+
:widths: 20 20 80
43+
44+
* - Field
45+
- Type
46+
- Description
47+
48+
* - ``logRotate``
49+
- integer or string
50+
- The log or logs to rotate, according to the following:
51+
52+
- ``1`` -- Rotates both the server and audit logs
53+
- ``"server"`` -- Rotates only the server log
54+
- ``"audit"`` -- Rotates only the audit log
55+
56+
* - ``comment``
57+
- string
58+
- *Optional.* A message logged by the server to the log file and
59+
audit file at time of log rotation.
60+
61+
You may also rotate the logs by sending a ``SIGUSR1`` signal to the
62+
:binary:`~bin.mongod` process.
63+
64+
For example, if a running :binary:`~bin.mongod` instance has a
65+
process ID (PID) of ``2200``, the following command rotates the log
66+
file for that instance on Linux:
67+
68+
.. code-block:: bash
69+
70+
kill -SIGUSR1 2200
6871

6972
Limitations
7073
-----------
@@ -111,11 +114,11 @@ The following example rotates both the server log and the audit log:
111114

112115
.. code-block:: javascript
113116

114-
db.adminCommand({logRotate: 1})
117+
db.adminCommand( { logRotate: 1 } )
115118

116119
The following example rotates only the audit log, and provides a custom
117120
message to the log file at time of rotation:
118121

119122
.. code-block:: javascript
120123

121-
db.adminCommand({logRotate: audit, comment: "Rotating audit log"})
124+
db.adminCommand( { logRotate: "audit", comment: "Rotating audit log" } )

0 commit comments

Comments
 (0)