Skip to content

Commit 7cd95b7

Browse files
DOCSP-47901-refactor-logging-landing-page (#389)
* init * first draft * edit * edits * wording
1 parent cb71e8a commit 7cd95b7

File tree

6 files changed

+97
-55
lines changed

6 files changed

+97
-55
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
.. note::
2-
3-
The |mdb-shell| redacts credentials from the :ref:`command history
4-
<mdb-shell-command-history>` and the :ref:`logs
5-
<mdb-shell-view-logs>`.
1+
The |mdb-shell| redacts credentials from the :ref:`command history
2+
<mdb-shell-command-history>` and the :ref:`logs <mdb-shell-view-logs>`.

source/logs.txt

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,64 @@
11
.. _mdb-shell-logs:
22

3-
===================
4-
Retrieve Shell Logs
5-
===================
6-
7-
.. default-domain:: mongodb
3+
==========
4+
Shell Logs
5+
==========
86

97
.. contents:: On this page
108
:local:
119
:backlinks: none
1210
:depth: 1
1311
:class: singlecol
1412

15-
|mdb-shell| uses `Newline delimited JSON
16-
<https://github.com/ndjson/ndjson-spec>`__ to store session logs.
17-
Starting in :binary:`mongosh` version 1.0.5, the log |mdb-shell| format
18-
is updated to match the MongoDB server log format. For details, see
19-
:ref:`log-messages-ref`.
20-
21-
You can view or tail the logs for a |mdb-shell| session based on its
22-
log ID.
23-
24-
.. include:: /includes/admonitions/note-redact-credentials-command-history.rst
13+
The |mdb-shell| stores a log for each session. The log contains a record
14+
of commands run, server connections, and other useful information about
15+
actions performed in the |mdb-shell|.
2516

26-
.. _mdb-shell-view-logs:
17+
Get Started
18+
-----------
2719

28-
View |mdb-shell| Logs
29-
---------------------
20+
You can view or tail the logs for a |mdb-shell| session based on its log
21+
ID.
3022

31-
.. include:: /includes/steps/view-logs.rst
23+
To learn how to view and customize |mdb-shell| logs, see these pages:
3224

33-
.. tip::
34-
35-
To change where MongoDB Shell writes logs, see
36-
:ref:`mongosh-log-location`.
25+
- :ref:`mdb-shell-view-logs`
26+
- :ref:`mdb-shell-command-history`
27+
- :ref:`mongosh-log-location`
28+
- :ref:`mongosh-custom-log-entries`
29+
- :ref:`mongosh-log-compression`
30+
- :ref:`mongosh-logs-disable`
3731

38-
.. _mdb-shell-command-history:
32+
Details
33+
-------
3934

40-
View |mdb-shell| Command History
41-
--------------------------------
35+
See the following details about |mdb-shell| logging behavior:
4236

43-
|mdb-shell| saves a history of all commands you've run across sessions.
44-
When a new command is issued, it is added to the beginning of the
45-
history file.
37+
Format
38+
~~~~~~
4639

47-
Open the following file in a text editor to view the |mdb-shell| command
48-
history:
40+
The |mdb-shell| uses `Newline delimited JSON
41+
<https://github.com/ndjson/ndjson-spec>`__ to store session logs, which
42+
is the same log format used for :ref:`MongoDB server logs
43+
<log-messages-ref>`.
4944

50-
.. list-table::
51-
:header-rows: 1
52-
:widths: 1 2
45+
Redaction
46+
~~~~~~~~~
5347

54-
* - Operating System
55-
- Path to History File
56-
57-
* - macOS and Linux
58-
- ``~/.mongodb/mongosh/mongosh_repl_history``
59-
60-
* - Windows
61-
- ``%UserProfile%/.mongodb/mongosh/mongosh_repl_history``
48+
.. include:: /includes/admonitions/note-redact-credentials-command-history.rst
6249

63-
Log Retention
64-
-------------
50+
Retention
51+
~~~~~~~~~
6552

66-
By default, ``mongosh`` retains up to 100 log files for 30 days.
67-
``mongosh`` automatically deletes log files older than 30 days. To
68-
customize log file retention, see :ref:`mongosh-logs-retention`.
53+
By default, the |mdb-shell| retains up to 100 log files, and individual
54+
log files are retained for 30 days. To customize log file retention, see
55+
:ref:`mongosh-logs-retention`.
6956

7057
.. toctree::
7158
:titlesonly:
7259

60+
View Logs </logs/view>
61+
View Command History </logs/command-history>
7362
Specify Log Location </logs/location>
7463
Write Custom Log Entries </logs/custom-entries>
7564
Retention </logs/retention>

source/logs/command-history.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _mdb-shell-command-history:
2+
3+
==========================
4+
View Shell Command History
5+
==========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
The |mdb-shell| saves a history of all commands you've run across
14+
sessions. When a new command is issued, it is added to the beginning of
15+
the history file.
16+
17+
Steps
18+
-----
19+
20+
To view the |mdb-shell| command history, open the following file in a
21+
text editor:
22+
23+
.. list-table::
24+
:header-rows: 1
25+
:widths: 1 2
26+
27+
* - Operating System
28+
- Path to History File
29+
30+
* - macOS and Linux
31+
- ``~/.mongodb/mongosh/mongosh_repl_history``
32+
33+
* - Windows
34+
- ``%UserProfile%/.mongodb/mongosh/mongosh_repl_history``

source/logs/view.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. _mdb-shell-view-logs:
2+
3+
===============
4+
View Shell Logs
5+
===============
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
The |mdb-shell| stores logs for each session. The default log location
14+
depends on your operating system.
15+
16+
.. include:: /includes/steps/view-logs.rst
17+
18+
.. tip::
19+
20+
To change where MongoDB Shell writes logs, see
21+
:ref:`mongosh-log-location`.

source/reference.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ Reference
1313
EJSON </reference/ejson>
1414
.mongoshrc Configuration File </mongoshrc>
1515
Options </reference/options>
16-
Retrieve Shell Logs </logs>
16+
Logs </logs>

source/write-scripts.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,9 @@ The following command connects to a MongoDB instance that is:
437437
this is the only way I could get it to work.
438438
https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/#opening-new-connections
439439

440-
.. include:: /includes/admonitions/note-redact-credentials-command-history.rst
440+
.. note::
441+
442+
.. include:: /includes/admonitions/note-redact-credentials-command-history.rst
441443

442444
Use ``connect()`` to Connect to a MongoDB Instance
443445
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -544,4 +546,3 @@ you do not have to edit the script to run ``portableGetUserCount.js``.
544546
require() versus load() </write-scripts/require-load-differences>
545547
Code Scoping </write-scripts/scoping>
546548
Considerations </write-scripts/considerations>
547-

0 commit comments

Comments
 (0)