Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli ops-manager logs jobs collect

On this page

The logs jobs collect command starts a job to collect logs from the specified Ops Manager project. You can also collect logs from an Ops Manager project through the Ops Manager API.

Syntax

mongocli ops-manager|om logs|log jobs|job collect <resourceType> <resourceName>
     --sizeRequestedPerFileBytes <number-of-bytes>
     --type <log-type>
     [ --redacted <boolean> ]
     [ --projectId <id-of-project> ]
     [ --profile|-P <profile-name> ]

Options

Option Type Description Required?
<resourceType> string

Type of resource from which to collect logs. Must be one of the following values:

  • CLUSTER
  • PROCESS
  • REPLICASET
yes
<resourceName> string Name of the resource from which to collect logs. yes
--sizeRequestedPerFileBytes number Size for each log file in bytes. yes
--type string

Type of logs to collect. Must be one of the following values:

  • AUTOMATION_AGENT
  • BACKUP_AGENT
  • MONITORING_AGENT
  • MONGODB
  • FTDC
yes
--redacted boolean If true, emails, hostnames, IP addresses, and namespaces in responses involving this job are replaced with random string values. 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 containing the logs you want to collect.

Note

You can retrieve the list of projects, including their IDs, using the mongocli iam project list command.

no

Output

The command prints a JSON document with an id field to the terminal if the command succeeds. If the command returns an error, see Troubleshooting for recommended solutions.

Name Type Description
id string Unique identifier of the created log collection job.

Examples

The following example uses the mongocli ops-manager logs jobs collect command to start a log collection job for MONGODB logs from a replica set named myReplicaSet. The project is specified in a profile named egOmProfile where the project ID and the Programmatic API Keys are stored.

mongocli ops-manager logs jobs collect REPLICASET myReplicaSet --sizeRequestedPerFileBytes 10000000 --type MONGODB --profile egOmProfile

The above command prints the following result in JSON format to the terminal. To learn more about this result, see Output.

{
        "id": "15ec3001b081a6533d071acf"
}