diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-29 10:07:50 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-29 10:07:50 +0200 |
commit | d2feb7063e73938c05b76862ea2e211cc09b30fe (patch) | |
tree | bb37e988053c1be6a7227a7f616fa239ac11e214 /runtime/conf.c | |
parent | b7c91420b0814ee20088d27953582a5064c9a467 (diff) | |
download | rsyslog-d2feb7063e73938c05b76862ea2e211cc09b30fe.tar.gz rsyslog-d2feb7063e73938c05b76862ea2e211cc09b30fe.tar.xz rsyslog-d2feb7063e73938c05b76862ea2e211cc09b30fe.zip |
enhanced configuration file error reporting and verification
- enhanced config file checking - no active actions are detected
- added -N rsyslogd command line option for a config validation run
(which does not execute actual syslogd code and does not interfere
with a running instance)
- somewhat improved emergency configuration. It is now also selected
if the config contains no active actions
- rsyslogd error messages are now reported to stderr by default. can be
turned off by the new "$ErrorMessagesToStderr off" directive
Thanks to HKS for suggesting these new features.
Diffstat (limited to 'runtime/conf.c')
-rw-r--r-- | runtime/conf.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/runtime/conf.c b/runtime/conf.c index 71b2b2da..6a7caa41 100644 --- a/runtime/conf.c +++ b/runtime/conf.c @@ -83,6 +83,8 @@ DEFobjCurrIf(module) DEFobjCurrIf(errmsg) DEFobjCurrIf(net) +static int iNbrActions; /* number of actions the running config has. Needs to be init on ReInitConf() */ + /* The following global variables are used for building * tag and host selector lines during startup and config reload. * This is stored as a global variable pool because of its ease. It is @@ -1060,6 +1062,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction) pAction->f_ReduceRepeated = 0; } pAction->bEnabled = 1; /* action is enabled */ + iNbrActions++; /* one more active action! */ } break; } @@ -1159,6 +1162,34 @@ cfline(uchar *line, selector_t **pfCurr) } +/* Reinitialize the configuration subsystem. This is a "work-around" to the fact + * that we do not yet have actual config objects. This method is to be called + * whenever a totally new config is started (which means on startup and HUP). + * Note that it MUST NOT be called for an included config file. + * rgerhards, 2008-07-28 + */ +static rsRetVal +ReInitConf(void) +{ + DEFiRet; + iNbrActions = 0; /* this is what we created the function for ;) - action count is reset */ + RETiRet; +} + + +/* return the current number of active actions + * rgerhards, 2008-07-28 + */ +static rsRetVal +GetNbrActActions(int *piNbrActions) +{ + DEFiRet; + assert(piNbrActions != NULL); + *piNbrActions = iNbrActions; + RETiRet; +} + + /* queryInterface function * rgerhards, 2008-02-29 */ @@ -1179,6 +1210,8 @@ CODESTARTobjQueryInterface(conf) pIf->doIncludeLine = doIncludeLine; pIf->cfline = cfline; pIf->processConfFile = processConfFile; + pIf->ReInitConf = ReInitConf; + pIf->GetNbrActActions = GetNbrActActions; finalize_it: ENDobjQueryInterface(conf) |