mongocli atlas logs download¶
The logs download
command downloads the logs for a specified
Atlas host to a .gz
file. You can also download
logs through the Atlas UI or
API.
Syntax¶
mongocli atlas logs|log download <hostname> <log-name> [ --start <start-date> ] [ --end <end-date> ] [ --force ] [ --out <file-destination>] [ --profile|-P <profile-name> ] [ --projectId <id-of-project> ]
Use -h
or --help
to view the command-line help for
this command.
Options¶
Option | Type | Description | Required? | |
---|---|---|---|---|
--end | string | Timestamp in the number of seconds that have elapsed since the UNIX epoch that specifies the end point for the range of log
messages to retrieve. Default is current timestamp. | no | |
--force | Overwrites an existing log file of the same name, if present. | no | ||
<hostname> | string | Name of the MongoDB host for which to download logs. To find the | yes | |
<log-name> | string | Name of the log file to retrieve. Valid values are:
Note Audit logs are only available if you have enabled Database Auditing for an Atlas project. | yes | |
--out | string | Output filename, path to filename, or standard output. The filename must be in the following format:
For standard output, value must be If omitted, MongoDB CLI downloads logs to your current directory
as | no | |
--profile , -P | string | Name of the profile where the public and private
keys for the project are saved. If omitted, uses the
default profile. To learn more about creating a
profile, see Configure the MongoDB CLI. | no | |
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no | |
--start | string | Timestamp in the number of seconds that have elapsed since the UNIX epoch that specifies starting point for the range of log
messages to retrieve. Default is 24 hours prior to the current
timestamp. | no |
Output¶
The command downloads the logs of the specified <hostname>
to:
- The current directory as a file named
<log-name>.gz
, or - A directory and filename you specify with the
--out
option.
If the command returns errors, see Troubleshooting for recommended solutions.
Examples¶
The following example uses the mongocli atlas logs download
command
to download the mongodb
logs from host
atlas-123abc-shard-00-00.111xx.mongodb.net
. It uses the default profile to access the project.
mongocli atlas logs download atlas-123abc-shard-00-00.111xx.mongodb.net mongodb.gz
The previous command downloads the log file mongodb.gz
to the
current directory.