Navigation

mongocli ops-manager logs jobs collect

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.

mongocli ops-manager|om logs|log jobs|job collect <resourceType> <resourceName>
--sizeRequestedPerFileBytes <number-of-bytes>
--type <log-type>
[ --redacted <boolean> ]
[ --output|-o <output-format> ]
[ --projectId <id-of-project> ]
[ --profile|-P <profile-name> ]
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
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

If omitted, the command returns output in the default format.

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.

Note

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

no

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.

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 command uses the default profile where the project ID and the Programmatic API Keys are stored.

mongocli ops-manager logs jobs collect REPLICASET myReplicaSet --sizeRequestedPerFileBytes 10000000 --type MONGODB --output json

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

{
"id": "15ec3001b081a6533d071acf"
}
Give Feedback