系统事件审计消息
在本页
注意
记录的JSON消息格式如下:
复制
{
atype: <String>,
ts : { "$date": <timestamp> },
local: { ip: <String>, port: <int> },
remote: { ip: <String>, port: <int> },
users : [ { user: <String>, db: <String> }, ... ],
roles: [ { role: <String>, db: <String> }, ... ],
param: <document>,
result: <int>
}
字段 | 类型 | 描述 |
---|---|---|
atype | string | |
ts | document | 文档包含日期和UTC时间格式为ISO 8601 |
local | document | 文档包含运行实例本地IP和端口 |
remote | document | 文档包含与事件相关的传入连接的远程ip和端口号 |
users | array | 数组包含一组用户识别文档。由于MongoDB允许会话以每个数据库的不同用户身份登录,因此该数组可以包含多个用户。每个文档都包含user字段记录用户名和db字段记录验证该用户的数据库名 |
roles | array | 数组包含文档,用于指定授予用户的角色。每个文档包含一个role字段记录角色名和一个db字段记录与该角色相关的数据库名 |
param | document | |
result | integer |
下表列出了每种atype或操作类型,相关的param详细信息和result值(如果有)。
atype | param | result |
authenticate | { user: , db: , mechanism: } | 0 - Success 18 - Authentication Failed |
authCheck | { command:, ns:., args:} ns字段是可选的。args字段可能已经被修改了。 | 0 - Success13 - Unauthorized to perform the operation.默认情况下,审计系统仅记录授权失败。要使系统记录授权成功,请使用auditAuthorizationSuccess 参数。[1] |
{ ns:.} | 0 - Success | |
createDatabase | { ns:} | 0 - Success |
{ ns:., indexName:, indexSpec:} | 0 - Success | |
renameCollection | { old:., new:.} | 0 - Success |
{ ns:.} | 0 - Success | |
{ ns:} | 0 - Success | |
{ ns:., indexName:} | 0 - Success | |
{ user:, db:, customData:, roles: [ { role: , db: }, ... ] } customData字段是可选的。 | 0 - Success | |
{ user:, db:} | 0 - Success | |
dropAllUsersFromDatabase | { db:} | 0 - Success |
updateUser | { user:, db:, passwordChanged:, customData:, roles: [ { role:, db: }, ... ] } customData 字段是可选的。 | 0 - Success |
grantRolesToUser | { user: , db: , roles: [ { role: , db: }, ... ] } | 0 - Success |
revokeRolesFromUser | { user: , db: , roles: [ { role: , db: }, ... ] } | 0 - Success |
{ role:, db:, roles: [ { role:, db: }, ... ], privileges: [ { resource:, actions: [, ... ] }, ... ] } roles和privileges字段是可选的,关于resource文档详情,请查看Resource Document.关于操作列表,请查看Privilege Actions. | 0 - Success | |
updateRole | { role:, db:, roles: [ { role:, db: }, ... ], privileges: [ { resource:, actions: [, ... ] }, ... ] } roles和privileges字段是可选的。关于resource文档详情,请查看Resource Document.关于操作列表,请查看Privilege Actions. | 0 - Success |
{ role:, db: } | 0 - Success | |
dropAllRolesFromDatabase | { db: } | 0 - Success |
grantRolesToRole | { role:, db:, roles: [ { role:, db: }, ... ] } | 0 - Success |
revokeRolesFromRole | { role:, db:, roles: [ { role:, db: }, ... ] } | 0 - Success |
grantPrivilegesToRole | { role:, db:, privileges: [ { resource:, actions: [, ... ] }, ... ] } 关于resource这个字段对应的文档,请查看Resource Document.关于操作列表,请查看Privilege Actions. | 0 - Success |
revokePrivilegesFromRole | { role:, db:, privileges: [ { resource:, actions: [, ... ] }, ... ] } 关于resource这个字段对应的文档,请查看Resource Document.关于操作列表,请查看Privilege Actions. | 0 - Success |
replSetReconfig | `{ old: { _id:, version:, ... members: [ ... ], settings: { ... } }, new: { _id:, version:, ... members: [ ... ], settings: { ... } } }关于副本集配置对应的文档, 请查看 Replica Set Configuration. | 0 - Success |
{ ns:} | 0 - Success | |
shardCollection | { ns:., key:, options: { unique:} } | 0 - Success |
{ shard:, connectionString::, maxSize:} 当分片 是副本集时,connectionString包含副本集集群名字和可以包含其他副本集成员。 | 0 - Success | |
{ shard:} | 0 - Success | |
{ } Indicates commencement of database shutdown. 指明数据库开始关闭 | 0 - Success | |
0 - Success |
译者:谢伟成
最近更新 1yr ago