Show
mlaunch init --dir clusters/main --replicaset --nodes 1 --auditDestination file --auditFormat JSON --auditPath clusters/main/replset/rs1/audit.log --auth --setParameter auditAuthorizationSuccess=true
Shell (after authenticating):
MongoDB Enterprise replset:PRIMARY> use test
MongoDB Enterprise replset:PRIMARY> db.test.insertMany([{a:1},{b:1},{c:1}])
{
"acknowledged" : true,
"insertedIds" : [
ObjectId("5d002216c8ebbc12a504aa55"),
ObjectId("5d002216c8ebbc12a504aa56"),
ObjectId("5d002216c8ebbc12a504aa57")
]
}
Audit file:
{ "atype" : "authCheck", "ts" : { "$date" : "2019-06-11T14:50:14.698-0700" }, "local" : { "ip" : "127.0.0.1", "port" : 27017 }, "remote" : { "ip" : "127.0.0.1", "port" : 60741 }, "users" : [ { "user" : "user", "db" : "admin" } ], "roles" : [ { "role" : "clusterAdmin", "db" : "admin" }, { "role" : "userAdminAnyDatabase", "db" : "admin" }, { "role" : "readWriteAnyDatabase", "db" : "admin" }, { "role" : "dbAdminAnyDatabase", "db" : "admin" } ], "param" : { "command" : "insert", "ns" : "test.test", "args" : { "insert" : "test", "ordered" : true, "lsid" : { "id" : { "$binary" : "JOeKlQjLRK2vRQd7NJDGOQ==", "$type" : "04" } }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1560289808, "i" : 1 } }, "signature" : { "hash" : { "$binary" : "4iDsdOVis5RHcK+h5LxWYNvwNyM=", "$type" : "00" }, "keyId" : { "$numberLong" : "6701392778519117825" } } }, "$db" : "test", "documents" : [ { "_id" : { "$oid" : "5d002216c8ebbc12a504aa55" }, "a" : 1 } ] } }, "result" : 0 }
{ "atype" : "authCheck", "ts" : { "$date" : "2019-06-11T14:50:14.708-0700" }, "local" : { "ip" : "127.0.0.1", "port" : 27017 }, "remote" : { "ip" : "127.0.0.1", "port" : 60741 }, "users" : [ { "user" : "user", "db" : "admin" } ], "roles" : [ { "role" : "clusterAdmin", "db" : "admin" }, { "role" : "userAdminAnyDatabase", "db" : "admin" }, { "role" : "readWriteAnyDatabase", "db" : "admin" }, { "role" : "dbAdminAnyDatabase", "db" : "admin" } ], "param" : { "command" : "replSetGetStatus", "ns" : "admin", "args" : { "replSetGetStatus" : 1, "forShell" : 1, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1560289814, "i" : 3 } }, "signature" : { "hash" : { "$binary" : "2+6hVAhdrssDlPVa7GI8o6rHub4=", "$type" : "00" }, "keyId" : { "$numberLong" : "6701392778519117825" } } }, "$db" : "admin" } }, "result" : 0 }
Which only contains:
"documents" : [ { "_id" : { "$oid" : "5d002216c8ebbc12a504aa55" }, "a" : 1 } ]