diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-09-17 12:30:00 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-09-17 12:30:00 +0200 |
commit | 8bea0d1d5762a3f0af74a5b9e9c0b15518774bec (patch) | |
tree | c957932f61f8ce1c38a0e4fa8861936af427b962 /tools | |
parent | 4ccd08139214fd2c97268b39412a11241edbd815 (diff) | |
download | rsyslog-8bea0d1d5762a3f0af74a5b9e9c0b15518774bec.tar.gz rsyslog-8bea0d1d5762a3f0af74a5b9e9c0b15518774bec.tar.xz rsyslog-8bea0d1d5762a3f0af74a5b9e9c0b15518774bec.zip |
added $AbortOnUncleanConfig directive
permits to prevent startup when there are problems with the configuration
file. See it's doc for details.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/syslogd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 26281005..912cca69 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -258,6 +258,7 @@ uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence f int bEscapeCCOnRcv = 1; /* escape control characters on reception: 0 - no, 1 - yes */ static int bErrMsgToStderr = 1; /* print error messages to stderr (in addition to everything else)? */ int bReduceRepeatMsgs; /* reduce repeated message - 0 - no, 1 - yes */ +int bAbortOnUncleanConfig = 0; /* abort run (rather than starting with partial config) if there was any issue in conf */ int bActExecWhenPrevSusp; /* execute action only when previous one was suspended? */ int iActExecOnceInterval = 0; /* execute action once every nn seconds */ /* end global config file state variables */ @@ -343,6 +344,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a bDebugPrintModuleList = 1; bEscapeCCOnRcv = 1; /* default is to escape control characters */ bReduceRepeatMsgs = 0; + bAbortOnUncleanConfig = 0; free(pszMainMsgQFName); pszMainMsgQFName = NULL; iMainMsgQueueSize = 10000; @@ -2251,6 +2253,14 @@ init(void) ABORT_FINALIZE(RS_RET_VALIDATION_RUN); } + if(bAbortOnUncleanConfig && bHadConfigErr) { + fprintf(stderr, "rsyslogd: $AbortOnUncleanConfig is set, and config is not clean.\n" + "Check error log for details, fix errors and restart. As a last\n" + "resort, you may want to remove $AbortOnUncleanConfig to permit a\n" + "startup with a dirty config.\n"); + exit(2); + } + /* switch the message object to threaded operation, if necessary */ if(MainMsgQueType == QUEUETYPE_DIRECT || iMainMsgQueueNumWorkers > 1) { MsgEnableThreadSafety(); @@ -2630,6 +2640,7 @@ static rsRetVal loadBuildInModules(void) CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuesaveonshutdown", 0, eCmdHdlrBinary, NULL, &bMainMsgQSaveOnShutdown, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuedequeuetimebegin", 0, eCmdHdlrInt, NULL, &iMainMsgQueueDeqtWinFromHr, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuedequeuetimeend", 0, eCmdHdlrInt, NULL, &iMainMsgQueueDeqtWinToHr, NULL)); + CHKiRet(regCfSysLineHdlr((uchar *)"abortonuncleanconfig", 0, eCmdHdlrBinary, NULL, &bAbortOnUncleanConfig, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"repeatedmsgreduction", 0, eCmdHdlrBinary, NULL, &bReduceRepeatMsgs, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlywhenpreviousissuspended", 0, eCmdHdlrBinary, NULL, &bActExecWhenPrevSusp, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlyonceeveryinterval", 0, eCmdHdlrInt, NULL, &iActExecOnceInterval, NULL)); |