Skip to content

DOCS-46 expand logRotate documentation #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions source/reference/command/logRotate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ logRotate

.. dbcommand:: logRotate

:dbcommand:`logRotate` is an admin only command that allows you to rotate
the MongoDB logs to prevent a single logfile from consuming too
much disk space. Use the following syntax: ::
:dbcommand:`logRotate` is an :term:`admin database` command that
allows you to rotate
the MongoDB logs. Use the following syntax:

.. code-block:: javascript

{ logRotate: 1 }

Expand All @@ -17,16 +19,30 @@ logRotate
Your :program:`mongod` instance needs to be running with the
:option:`--logpath [file] <mongod --logpath>` option.

You may also rotate the logs by sending a ``SIGUSR1`` signal to the :program:`mongod` process.
If your :program:`mongod` has a process ID of 2200, here's how to send the signal on Linux:
You may also rotate the logs by sending a ``SIGUSR1`` signal to the
:program:`mongod` process.
If your :program:`mongod` has a process ID of 2200, here's how to
send the signal on Linux:

.. code-block:: sh

kill -SIGUSR1 2200

The rotated files will have a timestamp appended to the filename.
:dbcommand:`logRotate` will cause the existing log file to be
renamed by appending the current timestamp to the filename.
The rotated files will have a timestamp of the form
<YYYY>-<mm>-<DD>T<HH>-<MM>-<SS>
appended to the filename.
A new log file will be created
with the name which was specified by the
:setting:`--logpath` runtime option to :program:`mongod`
or :program:`mongos`.

.. note::

The :dbcommand:`logRotate` command is not available to mongod instances
running on windows systems.
.. versionadded:: 2.0.3
The :dbcommand:`logRotate` command is available to
:program:`mongod` instances running on Windows systems with
MongoDB release 2.0.3 and higher.

.. :error:`16175` is thrown if logRotate fails