diff --git a/source/includes/log-changes-to-database-profiler.rst b/source/includes/log-changes-to-database-profiler.rst new file mode 100644 index 00000000000..7f9e2a4b88e --- /dev/null +++ b/source/includes/log-changes-to-database-profiler.rst @@ -0,0 +1,6 @@ +Starting in MongoDB 5.0 (also available starting in 4.4.2, 4.2.12, and +4.0.22), changes made to the :ref:`database profiler +` ``level``, ``slowms``, ``sampleRate``, or +``filter`` using the :dbcommand:`profile` command or +:method:`db.setProfilingLevel()` wrapper method are recorded in the +:option:`log file `. \ No newline at end of file diff --git a/source/reference/command/profile.txt b/source/reference/command/profile.txt index 9bdc2794ab6..07532d5679f 100644 --- a/source/reference/command/profile.txt +++ b/source/reference/command/profile.txt @@ -15,7 +15,7 @@ Definition .. dbcommand:: profile - .. versionchanged:: 4.4.2 + .. versionchanged:: 5.0 For a :binary:`~bin.mongod` instance, the command enables, disables, or configures the :doc:`/tutorial/manage-the-database-profiler`. The @@ -42,13 +42,15 @@ Definition :ref:`filter ` affect only the diagnostic log. - (*Starting in MongoDB 4.0*): For :binary:`~bin.mongos` instance, the + Starting in MongoDB 4.0, for a :binary:`~bin.mongos` instance, the command only configures how operations get written to the diagnostic log. You cannot enable the :doc:`/tutorial/manage-the-database-profiler` on a :binary:`~bin.mongos` instance because ``mongos`` does not have any collections that the profiler can write to. + .. include:: /includes/log-changes-to-database-profiler.rst + On :binary:`~bin.mongos`, you can set ``profile`` level to: - ``0`` to set the ``slowms``, ``sampleRate``, and ``filter`` for diff --git a/source/reference/method/db.setProfilingLevel.txt b/source/reference/method/db.setProfilingLevel.txt index 4a5642bd4a4..a2bfaf6a53d 100644 --- a/source/reference/method/db.setProfilingLevel.txt +++ b/source/reference/method/db.setProfilingLevel.txt @@ -17,7 +17,7 @@ Definition .. method:: db.setProfilingLevel(level, options) - .. versionchanged:: 4.4.2 + .. versionchanged:: 5.0 For a :binary:`~bin.mongod` instance, the method enables, disables, or configures the :doc:`/tutorial/manage-the-database-profiler`. The @@ -28,7 +28,7 @@ Definition log. If the :ref:`database profiler level ` is - ``1`` or ``2`` (i.e. the :doc:`database profiler + ``1`` or ``2`` (specifically, the :doc:`database profiler ` is enabled), the :ref:`slowms `, :ref:`sampleRate ` affect @@ -36,14 +36,14 @@ Definition `. If the :ref:`database profiler level ` is - ``0`` (i.e. :doc:`database profiler + ``0`` (specifically, :doc:`database profiler ` is disabled), the :ref:`slowms ` and :ref:`sampleRate `, affect only the diagnostic log. - (*Starting in MongoDB 4.0*): For a :binary:`~bin.mongos` instance, - the method sets the ``slowms``, ``sampleRate`` and ``filter`` + Starting in MongoDB 4.0, for a :binary:`~bin.mongos` instance, the + method sets the ``slowms``, ``sampleRate`` and ``filter`` configuration settings, which configure how operations get written to the diagnostic log. You cannot enable the :doc:`/tutorial/manage-the-database-profiler` on a @@ -62,6 +62,8 @@ Definition :method:`db.setProfilingLevel()` provides a wrapper around the :dbcommand:`profile` command. + .. include:: /includes/log-changes-to-database-profiler.rst + Syntax ~~~~~~ @@ -97,7 +99,7 @@ Parameters .. include:: /includes/database-profiler-levels.rst - Since profiling is not available on :binary:`~bin.mongos`, + Because profiling is not available on :binary:`~bin.mongos`, :method:`db.setProfilingLevel()` cannot be used to set the profiling level to a value other than ``0`` on a :binary:`~bin.mongos` instance. @@ -128,9 +130,9 @@ Parameters For :binary:`~bin.mongod` instances, the setting affects both the diagnostic log and, if enabled, the profiler. - For :binary:`~bin.mongos` instances, the setting affects the - diagnostic log only and not the profiler since profiling is not - available on :binary:`~bin.mongos`. + For :binary:`~bin.mongos` instances, the setting affects + the diagnostic log only and not the profiler because + profiling is not available on :binary:`~bin.mongos`. .. note:: This argument affects the same setting as the configuration @@ -149,9 +151,9 @@ Parameters For :binary:`~bin.mongod` instances, the setting affects both the diagnostic log and, if enabled, the profiler. - For :binary:`~bin.mongos` instances, the setting affects the - diagnostic log only and not the profiler since profiling is not - available on :binary:`~bin.mongos`. + For :binary:`~bin.mongos` instances, the setting affects + the diagnostic log only and not the profiler because + profiling is not available on :binary:`~bin.mongos`. .. note:: This argument affects the same setting as the configuration option @@ -170,9 +172,9 @@ Parameters For :binary:`~bin.mongod` instances, the setting affects both the diagnostic log and, if enabled, the profiler. - For :binary:`~bin.mongos` instances, the setting affects the - diagnostic log only and not the profiler since profiling is not - available on :binary:`~bin.mongos`. + For :binary:`~bin.mongos` instances, the setting affects + the diagnostic log only and not the profiler because + profiling is not available on :binary:`~bin.mongos`. For an example of a filter used to control logged operations, see :ref:`profiler-filter-example`. diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt index 1385b877bbd..8a1437d7392 100644 --- a/source/release-notes/5.0.txt +++ b/source/release-notes/5.0.txt @@ -251,6 +251,11 @@ See: - :method:`db.setProfilingLevel()` - :dbcommand:`profile` +Log Changes to Database Profiler Settings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/log-changes-to-database-profiler.rst + ``serverStatus`` Output Change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/tutorial/manage-the-database-profiler.txt b/source/tutorial/manage-the-database-profiler.txt index 401753ffa6b..625c0d024d1 100644 --- a/source/tutorial/manage-the-database-profiler.txt +++ b/source/tutorial/manage-the-database-profiler.txt @@ -31,8 +31,7 @@ When enabled, profiling has an effect on database performance and disk use. See :ref:`Database Profiler Overhead` for more information. This document outlines a number of key administration options for the -database profiler. For additional related information, consider the -following resources: +database profiler. For additional related information, see: - :doc:`/reference/database-profiler` - :doc:`Profile Command ` @@ -53,7 +52,7 @@ The following profiling levels are available: Enable and Configure Database Profiling --------------------------------------- -You can enable database profiling for :binary:`~bin.mongod` instances . +You can enable database profiling for :binary:`~bin.mongod` instances. This section uses the :binary:`~bin.mongo` shell helper :method:`db.setProfilingLevel()` helper to enable profiling. For @@ -86,6 +85,8 @@ The ``"ok" : 1`` key-value pair indicates the operation succeeded: To verify the new setting, see the :ref:`database-profiling-view-status` section. +.. include:: /includes/log-changes-to-database-profiler.rst + Global and Per-Database Profiling Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~