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.
Syntax
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> ]
Options
Option | Type | Description | Required? |
---|---|---|---|
<resourceType> | string | Type of resource from which to collect logs. Must be one of the following values:
| 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:
| 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:
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. NoteYou can retrieve the list of projects, including their IDs, using
the | 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. |
Example
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" }