@@ -13,32 +13,31 @@ Rotate Log Files
1313Overview
1414--------
1515
16- When used with the ``--logpath`` option or :setting:`systemLog.path` setting,
17- :binary:`~bin.mongod` and :binary:`~bin.mongos` instances report
18- a live account of all activity and operations to a log file.
19- When reporting activity data to a log file, by default, MongoDB only rotates logs
20- in response to the :dbcommand:`logRotate` command, or when the
21- :binary:`~bin.mongod` or :binary:`~bin.mongos` process receives a ``SIGUSR1``
22- signal from the operating system.
16+ When used with the ``--logpath`` option or :setting:`systemLog.path`
17+ setting, :binary:`~bin.mongod` and :binary:`~bin.mongos` instances
18+ report a live account of all activity and operations to a log file.
19+ When reporting activity data to a log file, by default, MongoDB only
20+ rotates logs in response to the :dbcommand:`logRotate` command, or when
21+ the :binary:`~bin.mongod` or :binary:`~bin.mongos` process receives a
22+ ``SIGUSR1`` signal from the operating system.
2323
2424MongoDB's standard log rotation approach archives the current
2525log file and starts a new one. To do this, the :binary:`~bin.mongod` or
26- :binary:`~bin.mongos` instance renames the current log file by appending a
27- UTC timestamp to the filename, in :term:`ISODate` format. It then
26+ :binary:`~bin.mongos` instance renames the current log file by appending
27+ a UTC timestamp to the filename, in :term:`ISODate` format. It then
2828opens a new log file, closes the old log file, and sends all new log
2929entries to the new log file.
3030
31- You can also configure MongoDB to support the Linux/Unix
32- logrotate utility
33- by setting :setting:`systemLog.logRotate` or
31+ You can also configure MongoDB to support the Linux/Unix ``logrotate``
32+ utility by setting :setting:`systemLog.logRotate` or
3433``--logRotate`` to ``reopen``. With ``reopen``, :binary:`~bin.mongod`
3534or :binary:`~bin.mongos` closes the log file, and
3635then reopens a log file with the same name, expecting that another
3736process renamed the file prior to rotation.
3837
3938Finally, you can configure :binary:`~bin.mongod` to send log data to the
40- ``syslog``. using the :option:`--syslog <mongod --syslog>` option. In this case, you can
41- take advantage of alternate logrotation tools.
39+ ``syslog`` using the :option:`--syslog <mongod --syslog>` option. In
40+ this case, you can take advantage of alternate log rotation tools.
4241
4342.. seealso:: For information on logging, see the
4443 :ref:`monitoring-standard-loggging` section.
@@ -50,8 +49,8 @@ By default, MongoDB uses the
5049``--logRotate rename`` behavior.
5150With ``rename``, :binary:`~bin.mongod` or
5251:binary:`~bin.mongos` renames the current log file by appending a UTC
53- timestamp to the filename, opens a new log file, closes the old log file,
54- and sends all new log entries to the new log file.
52+ timestamp to the filename, opens a new log file, closes the old log
53+ file, and sends all new log entries to the new log file.
5554
5655.. include:: /includes/steps/log-rotate-rename.rst
5756
@@ -68,17 +67,27 @@ the log file following the typical Linux/Unix log rotate behavior.
6867Syslog Log Rotation
6968-------------------
7069
71- With syslog log rotation, :binary:`~bin.mongod` sends log data to the syslog
72- rather than writing it to a file.
70+ With syslog log rotation, :binary:`~bin.mongod` sends log data to the
71+ syslog rather than writing it to a file.
7372
7473.. include:: /includes/steps/log-rotate-syslog.rst
7574
7675Forcing a Log Rotation with ``SIGUSR1``
7776---------------------------------------
7877
7978For Linux and Unix-based systems, you can use the ``SIGUSR1`` signal
80- to rotate the logs for a single process, as in the following:
79+ to rotate the logs for a single process.
80+
81+ For example, if a running :binary:`~bin.mongod` instance has a
82+ process ID (PID) of ``2200``, the following command rotates the log
83+ file for that instance on Linux:
8184
8285.. code-block:: sh
8386
84- kill -SIGUSR1 <mongod process id>
87+ kill -SIGUSR1 2200
88+
89+ Interaction with Audit Logs
90+ ---------------------------
91+
92+ If :doc:`auditing </core/auditing>` is enabled, the
93+ :dbcommand:`logRotate` command also rotates the audit log.
0 commit comments