diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-11-13 10:06:14 -0500 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-11-13 10:58:40 -0500 |
commit | 766b3e3508b7c1025dfc55ea8a4a01179989c9f4 (patch) | |
tree | 5333b5e31d8168becf84355d17a27bb324cc74c1 /src | |
parent | 442fdaa06ac941e88794c9ab3e5b9294b09ae004 (diff) | |
download | mongo-766b3e3508b7c1025dfc55ea8a4a01179989c9f4.tar.gz |
SERVER-20845 audit log reconfigs
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator_impl.cpp | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript index 4fab475d306..69f5e292331 100644 --- a/src/mongo/db/repl/SConscript +++ b/src/mongo/db/repl/SConscript @@ -250,7 +250,6 @@ env.Library('topology_coordinator_impl', 'topology_coordinator_impl.cpp', ], LIBDEPS=[ - '$BUILD_DIR/mongo/db/audit', 'replication_executor', 'replica_set_messages', 'repl_settings', @@ -291,6 +290,7 @@ env.Library('repl_coordinator_impl', 'vote_requester.cpp', ], LIBDEPS=[ + '$BUILD_DIR/mongo/db/audit', '$BUILD_DIR/mongo/db/common', '$BUILD_DIR/mongo/db/global_timestamp', '$BUILD_DIR/mongo/db/index/index_descriptor', diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index a4dc7172fce..7a16d5eb894 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -36,6 +36,8 @@ #include <limits> #include "mongo/base/status.h" +#include "mongo/db/audit.h" +#include "mongo/db/client_basic.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/global_timestamp.h" #include "mongo/db/index/index_descriptor.h" @@ -2053,6 +2055,10 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* txn, return status; } + BSONObj oldConfigObjForAudit = _rsConfig.toBSON(); + BSONObj newConfigObjForAudit = newConfig.toBSON(); + audit::logReplSetReconfig( + ClientBasic::getCurrent(), &oldConfigObjForAudit, &newConfigObjForAudit); const stdx::function<void(const ReplicationExecutor::CallbackArgs&)> reconfigFinishFn( stdx::bind(&ReplicationCoordinatorImpl::_finishReplSetReconfig, this, @@ -2173,6 +2179,11 @@ Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* txn, return status; } + BSONObj oldConfigObjForAudit; + BSONObj newConfigObjForAudit = newConfig.toBSON(); + audit::logReplSetReconfig( + ClientBasic::getCurrent(), &oldConfigObjForAudit, &newConfigObjForAudit); + if (replEnabled) { CBHStatus cbh = _replExecutor.scheduleWork( stdx::bind(&ReplicationCoordinatorImpl::_finishReplSetInitiate, diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp index 40e36edc9ba..479f8bc1181 100644 --- a/src/mongo/db/repl/topology_coordinator_impl.cpp +++ b/src/mongo/db/repl/topology_coordinator_impl.cpp @@ -34,8 +34,6 @@ #include <limits> -#include "mongo/db/audit.h" -#include "mongo/db/client_basic.h" #include "mongo/db/operation_context.h" #include "mongo/db/repl/heartbeat_response_action.h" #include "mongo/db/repl/is_master_response.h" |