文档菜单
文档首页
/ /
MongoDB CLI
/ / / /

mongocli ops-manager performanceAdvisor slowQueryLogs 列表

本页内容

  • 语法
  • 选项
  • 继承选项
  • 示例

返回性能顾问和查询分析器识别的慢查询的日志行。

性能顾问监控MongoDB认为较慢的查询,并建议新的索引以提高查询性能。慢查询的阈值根据您集群上操作的平均时间来提供与您的工作负载相关的建议。

如果您没有设置持续时间选项或since选项,此命令将返回过去24小时的数据。

要使用此命令,您必须使用具有项目数据访问读/写角色的用户帐户或API密钥进行身份验证。

命令语法
mongocli ops-manager performanceAdvisor slowQueryLogs list [options]
名称
类型
必需
描述
--duration
int
false
返回结果的毫秒数长度。如果您指定since选项,则持续时间从指定的日期和时间开始。如果您不设置since选项,则此命令返回当前时间之前的时间段的数据。
-h, --help
false
list的帮助信息
--hostId
string
true
MongoDB进程主机的唯一标识符。
--nLog
int
false
返回的最大日志行数。此值默认为20000。
--namespaces
string
false
要检索建议的慢查询日志的命名空间,格式为 <database>.<collection>。省略此参数以返回所有命名空间的结果。
-o, --output
string
false
输出格式。有效值包括json、json-path、go-template或go-template-file。要查看完整输出,请使用-o json选项。
--projectId
string
false
用于标识项目的十六进制字符串。此选项覆盖配置文件或环境变量的设置。
--since
int
false
查询检索建议索引的日期和时间。将此值指定为自UNIX纪元以来经过的秒数。如果不设置持续时间选项,则此命令返回从since值到当前时间的所有数据。
名称
类型
必需
描述
-P, --profile
string
false
从您的配置文件中使用的配置文件名称。有关MongoCLI配置文件的配置文件信息,请参阅https://dochub.mongodb.org/core/atlas-cli-configuration-file.
# Return a JSON-formatted list of log lines for collections with slow queries for the atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 host in the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli [ops-manager|cloud-manager] performanceAdvisor slowQueryLogs list --processName atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 --projectId 5e2211c17a3e5a48f5497de3 --output json

返回

慢查询日志

© . All rights reserved.