summaryrefslogtreecommitdiff
path: root/src/mongo/db/server_options_helpers.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2014-06-05 14:55:52 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2014-06-06 18:19:01 -0400
commit616461d294bd9f5054ca38b302b6fc5d70fde20c (patch)
tree671cd2efc28166c2a8cb9d6273954e5a38ea5255 /src/mongo/db/server_options_helpers.cpp
parentdae863af3f695fe98c16473ca07d79fb106121c0 (diff)
downloadmongo-616461d294bd9f5054ca38b302b6fc5d70fde20c.tar.gz
SERVER-4905: add flag to disable mongo's builtin log rotation
To support the standalone utility, we need to give administrators support for disabling Mongo's builtin log rotation.
Diffstat (limited to 'src/mongo/db/server_options_helpers.cpp')
-rw-r--r--src/mongo/db/server_options_helpers.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index 67bff90a0bc..62c4bc8b27f 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -198,6 +198,9 @@ namespace {
options->addOptionChaining("systemLog.logAppend", "logappend", moe::Switch,
"append to logpath instead of over-writing");
+ options->addOptionChaining("systemLog.logRotate", "logRotate", moe::String,
+ "set the log rotation behavior (rename|reopen)");
+
options->addOptionChaining("systemLog.timeStampFormat", "timeStampFormat", moe::String,
"Desired format for timestamps in log messages. One of ctime, "
"iso8601-utc or iso8601-local");
@@ -814,6 +817,25 @@ namespace {
serverGlobalParams.logAppend = true;
}
+ if (params.count("systemLog.logRotate")) {
+ std::string logRotateParam = params["systemLog.logRotate"].as<string>();
+ if (logRotateParam == "reopen") {
+ serverGlobalParams.logRenameOnRotate = false;
+
+ if(serverGlobalParams.logAppend == false) {
+ return Status(ErrorCodes::BadValue,
+ "logAppend must equal true if logRotate is set to reopen" );
+ }
+ }
+ else if (logRotateParam == "rename") {
+ serverGlobalParams.logRenameOnRotate = true;
+ }
+ else {
+ return Status(ErrorCodes::BadValue,
+ "unsupported value for logRotate " + logRotateParam );
+ }
+ }
+
if (!serverGlobalParams.logpath.empty() && serverGlobalParams.logWithSyslog) {
return Status(ErrorCodes::BadValue, "Cant use both a logpath and syslog ");
}