Skip to content

Commit

Permalink
SERVER-53278: Define and emit an audit event on system startup
Browse files Browse the repository at this point in the history
  • Loading branch information
varunravi98 authored and Evergreen Agent committed Dec 18, 2020
1 parent 6dfd7c3 commit 9c6a437
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mongo/db/audit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ void mongo::audit::logReplSetReconfig(Client* client,

void mongo::audit::logApplicationMessage(Client* client, StringData msg) {}

void mongo::audit::logStartupOptions(Client* client, const BSONObj& startupOptions) {}

void mongo::audit::logShutdown(Client* client) {}

void mongo::audit::logCreateIndex(Client* client,
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/db/audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ void logReplSetReconfig(Client* client, const BSONObj* oldConfig, const BSONObj*
*/
void logApplicationMessage(Client* client, StringData msg);

/**
* Logs the options associated with a startup event.
*/
void logStartupOptions(Client* client, const BSONObj& startupOptions);

/**
* Logs the result of a shutdown command.
*/
Expand Down
1 change: 1 addition & 0 deletions src/mongo/db/mongod_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) {
#endif

logProcessDetails(nullptr);
audit::logStartupOptions(Client::getCurrent(), serverGlobalParams.parsedOpts);

serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongod>(serviceContext));

Expand Down
1 change: 1 addition & 0 deletions src/mongo/s/mongos_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ ExitCode runMongosServer(ServiceContext* serviceContext) {
ThreadClient tc("mongosMain", serviceContext);

logShardingVersionInfo(nullptr);
audit::logStartupOptions(tc.get(), serverGlobalParams.parsedOpts);

// Set up the periodic runner for background job execution
{
Expand Down

0 comments on commit 9c6a437

Please sign in to comment.