Definition定义
logApplicationMessageThelogApplicationMessagecommand allows users to post a custom message to the audit log.logApplicationMessage命令允许用户将自定义消息发布到审核日志中。If running with authorization, users must have如果使用授权运行,则用户必须具有clusterAdminrole, or roles that inherit fromclusterAdmin, to run the command.clusterAdmin角色或从clusterAdmin继承的角色才能运行该命令。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
The command has the following syntax:该命令具有以下语法:
db.runCommand(
{
logApplicationMessage: <string>
}
)Behavior行为
MongoDB associates these custom messages with the audit operation MongoDB将这些自定义消息与审计操作applicationMessage, and the messages are subject to any filtering.applicationMessage相关联,并且这些消息会受到任何筛选。