Docs Menu
Docs Home
/ /
Atlas CLI
/ /

atlas logs download

On this page

  • Syntax
  • Arguments
  • Options
  • Inherited Options
  • Output
  • Examples

Download a compressed file that contains the MongoDB logs for the specified host.

This command downloads a file with a .gz extension.

To find the hostnames for an Atlas project, use the process list command.

To use this command, you must authenticate with a user account or an API key with the Project Data Access Read/Write role.

Command Syntax
atlas logs download <hostname> <mongodb.gz|mongos.gz|mongosqld.gz|mongodb-audit-log.gz|mongos-audit-log.gz> [options]
Name
Type
Required
Description
hostname
string
true
Label that identifies the host that stores the log files that you want to download.
mongodb.gz|mongos.gz|mongosqld.gz|mongodb-audit-log.gz|mongos-audit-log.gz
string
true
Log file that you want to return.
Name
Type
Required
Description
-d, --decompress
false
Flag that indicates whether to decompress the log files.
--end
int
false
Ending date and time for the range of log messages to retrieve, given in UNIX time. Defaults to the start date plus 24 hours, if the start date is set. If start date is not provided, ending time defaults to the current time.
--force
false
Flag that indicates whether to overwrite the destination file.
-h, --help
false
help for download
--out
string
false
Output file name. This value defaults to the log name.
--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
--start
int
false
UNIX Epoch-formatted starting date and time for the range of log messages to retrieve. This value defaults to 24 hours prior to the current timestamp.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.

If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.

Download of <Name> completed.
# Download the mongodb log file from the host atlas-123abc-shard-00-00.111xx.mongodb.net for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas logs download atlas-123abc-shard-00-00.111xx.mongodb.net mongodb.gz --projectId 5e2211c17a3e5a48f5497de3

Back

logs