2828 mongocli atlas logs|log download <hostname> <log-name>
2929 [ --start <start-date> ]
3030 [ --end <end-date> ]
31+ [ --force ]
3132 [ --out <file-destination>]
3233 [ --profile|-P <profile-name> ]
3334 [ --projectId <id-of-project> ]
@@ -55,6 +56,11 @@ Options
5556 messages to retrieve. Default is current timestamp.
5657 - no
5758
59+ * - ``--force``
60+ -
61+ - Overwrites an existing log file of the same name, if present.
62+ - no
63+
5864 * - ``<hostname>``
5965 - string
6066 - Name of the MongoDB host for which to download logs.
@@ -68,7 +74,7 @@ Options
6874
6975 * - ``<log-name>``
7076 - string
71- - The name of the log file to retrieve. Valid values are:
77+ - Name of the log file to retrieve. Valid values are:
7278
7379 - :manual:`mongodb.gz </reference/program/mongod/>`
7480
@@ -87,16 +93,20 @@ Options
8793
8894 * - ``--out``
8995 - string
90- - Output filename or path to filename. Value must be in the
91- following format:
96+ - Output filename, path to filename, or standard output.
97+ The filename must be in the following format:
9298
9399 .. code-block:: text
94100 :copyable: false
95101
96102 <file-name>.<extension>.gz
97103
98- If omitted, {+mcli+} downloads logs to your current directory as
99- ``<log-name>.log.gz``.
104+ For standard output, value must be ``/dev/stdout``. The
105+ command returns the output in compressed format, which you
106+ can decompress using an appropriate tool for you OS.
107+
108+ If omitted, {+mcli+} downloads logs to your current directory
109+ as ``<log-name>.log.gz``.
100110 - no
101111
102112 * - ``--profile``, ``-P``
@@ -145,10 +155,35 @@ The following example uses the ``mongocli atlas logs download`` command
145155to download the ``mongodb`` logs from host
146156``atlas-123abc-shard-00-00.111xx.mongodb.net``. It uses the {+default-profile+} to access the project.
147157
148- .. code-block:: text
149- :copyable: false
158+ .. tabs::
159+
160+ .. tab:: Basic Example
161+ :tabid: basic
162+
163+ .. code-block:: text
164+ :copyable: false
165+
166+ mongocli atlas logs download atlas-123abc-shard-00-00.111xx.mongodb.net mongodb.gz
167+
168+ The previous command downloads the log file ``mongodb.gz`` to the
169+ current directory.
170+
171+ .. tab:: Standard Output Example
172+ :tabid: stdout
173+
174+ The following command uses ``gunzip`` to decompress the output.
175+
176+ .. code-block:: text
177+ :copyable: false
178+
179+ mongocli atlas logs download atlas-123abc-shard-00-00.111xx.mongodb.net mongodb.gz --out /dev/stdout --force | gunzip
180+
181+ The previous command prints log entries similar to the following
182+ to the terminal.
150183
151- mongocli atlas logs download atlas-123abc-shard-00-00.111xx.mongodb.net mongodb.gz
184+ .. code-block:: text
185+ :copyable: false
152186
153- The previous command downloads the log file ``mongodb.gz`` to the
154- current directory.
187+ 2020-11-06T17:16:45.801+0000 I INDEX [initandlisten] index build: done building index _id_ on ns local.startup_log
188+ 2020-11-06T17:16:45.801+0000 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
189+ ...
0 commit comments