Navigation

mongocli ops-manager performanceAdvisor slowQueryLogs

The performanceAdvisor slowQueryLogs command retrieves a list of log lines for slow queries. You can also analyze slow queries through the Ops Manager UI or API.

mongocli ops-manager|om performanceadvisor slowQueryLog|s ls
--hostId <host-name>
[ --since <unix-epoch-timestamp> ]
[ --duration <milliseconds> ]
[ --nLogs <max-log-lines> ]
[ --namespace <namespaces> ]
[ --projectId <project-ID> ]
Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
--hostId
string
The unique identifier of the host of a MongoDB process. Use the process list command to retrieve your hostId.
yes
--since
integer
Point in time, specified as a timestamp in the number of milliseconds that have elapsed since the UNIX epoch, from which you want to retrieve results.
no
--duration
string
Length of time from the since parameter, in milliseconds, for which you want to retrieve results.
no
--nLogs
integer
Maximum number of log lines to return. Defaults to 20000.
no
--namespace
string
Namespace from which to retrieve slow query logs. A namespace consists of the database and collection resource separated by a ., such as <database>.<collection>.
no
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

no
Note

If since is indicated and duration is omitted, the response contains results from the since point up to the present time.

If duration is indicated and since is omitted, the response contains results from duration ms ago through the present time.

If both since and duration are omitted, the response contains results from the previous 24 hours up through the present time.

If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.

NAMESPACE LINE
<database>.<collection> log line

The default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the Public API reference for your MongoDB service:

The following command retrieves the namespaces for collections experiencing slow queries for a project using the default profile, which contains credentials to access the project and the project ID. The output is returned in the default format.

mongocli om performanceAdvisor slowQueryLogs ls --hostId 78b0e5ae329f98047bddeac69ab40bc5

The previous command prints the following to the terminal.

NAMESPACE LINE
myDB.users "2018-08-16T22:53:43.447+0000 I COMMAND [conn10614] command myDb.users appName: \"MongoDB Shell\" command: find { find: \"users\", filter: { emails: \"tocde@fijoow.to\" }, lsid: { id: UUID(\"832b4b0e-085a-480e-b470-16a0994dc7cb\") }, $clusterTime: { clusterTime: Timestamp(1534460016, 1)..."
myDB.users "2018-08-16T22:54:32.705+0000 I COMMAND [conn10614] command myDb.users appName: \"MongoDB Shell\" command: find { find: \"users\", filter: { emails: \"la@sa.kp\" }, lsid: { id: UUID(\"832b4b0e-085a-480e-b470-16a0994dc7cb\") }, $clusterTime: { clusterTime: Timestamp(1534460056, 1), ..."
Give Feedback