@@ -20,51 +20,54 @@ Definition
20
20
prevent a single logfile from consuming too much disk space.
21
21
22
22
You must issue the :dbcommand:`logRotate` command against the
23
- :term:`admin database` in the form :
23
+ :term:`admin database` using the following syntax :
24
24
25
25
.. 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
68
71
69
72
Limitations
70
73
-----------
@@ -111,11 +114,11 @@ The following example rotates both the server log and the audit log:
111
114
112
115
.. code-block:: javascript
113
116
114
- db.adminCommand({ logRotate: 1} )
117
+ db.adminCommand( { logRotate: 1 } )
115
118
116
119
The following example rotates only the audit log, and provides a custom
117
120
message to the log file at time of rotation:
118
121
119
122
.. code-block:: javascript
120
123
121
- db.adminCommand({ logRotate: audit, comment: "Rotating audit log"} )
124
+ db.adminCommand( { logRotate: " audit" , comment: "Rotating audit log" } )
0 commit comments