From c49042eb41a0ab0bba1f470f0457b379e6d6ad5e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 10:51:21 +0000 Subject: implemented $OmitLocalLogging config directive --- plugins/imuxsock/imuxsock.c | 24 +++++++++++++----------- rsyslogd.8 | 19 ------------------- syslogd.c | 3 --- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index 924630fc..ec81b6f0 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -40,7 +40,7 @@ #include "module-template.h" MODULE_TYPE_INPUT -TERM_SYNC_TYPE(eTermSync_SIGNAL) +TERM_SYNC_TYPE(eTermSync_NONE) /* defines */ #define MAXFUNIX 20 @@ -56,15 +56,18 @@ DEF_IMOD_STATIC_DATA typedef struct _instanceData { } instanceData; -int startIndexUxLocalSockets = 0; /* process funix from that index on (used to +static int startIndexUxLocalSockets; /* process funix from that index on (used to * suppress local logging. rgerhards 2005-08-01 * read-only after startup */ -int funixParseHost[MAXFUNIX] = { 0, }; /* should parser parse host name? read-only after startup */ -char *funixn[MAXFUNIX] = { _PATH_LOG }; /* read-only after startup */ -int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ +static int funixParseHost[MAXFUNIX] = { 0, }; /* should parser parse host name? read-only after startup */ +static char *funixn[MAXFUNIX] = { _PATH_LOG }; /* read-only after startup */ +static int funix[MAXFUNIX] = { -1, }; /* read-only after startup */ static int nfunix = 1; /* number of Unix sockets open / read-only after startup */ +/* config setting */ +static int bOmitLocalLogging = 0; + static int create_unix_socket(const char *path) { @@ -134,10 +137,6 @@ CODESTARTrunInput * right into the sleep below. */ while(1) { - /* we do not need to handle the RS_RET_TERMINATE_NOW case any - * special because we just need to terminate. Cleanup is done - * during afterRun(). -- rgerhards 2007-12-20 - */ /* Add the Unix Domain Sockets to the list of read * descriptors. * rgerhards 2005-08-01: we must now check if there are @@ -154,7 +153,7 @@ CODESTARTrunInput } } - /* select() here */ + /* wait for io to become ready */ nfds = select(maxfds+1, (fd_set *) &readfds, NULL, NULL, NULL); for (i = 0; i < nfunix && nfds > 0; i++) { @@ -172,6 +171,8 @@ ENDrunInput BEGINwillRun CODESTARTwillRun register int i; + + startIndexUxLocalSockets = bOmitLocalLogging ? 1 : 0; for (i = 1; i < MAXFUNIX; i++) { funixn[i] = ""; funix[i] = -1; @@ -229,6 +230,7 @@ ENDqueryEtryPt static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) { + bOmitLocalLogging = 0; return RS_RET_OK; } @@ -236,7 +238,7 @@ BEGINmodInit() CODESTARTmodInit *ipIFVersProvided = 1; /* so far, we only support the initial definition */ CODEmodInit_QueryRegCFSLineHdlr - //CHKiRet(omsdRegCFSLineHdlr((uchar *)"markmessageperiod", 0, eCmdHdlrInt, NULL, &iMarkMessagePeriod, STD_LOADABLE_MODULE_ID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"omitlocallogging", 0, eCmdHdlrBinary, NULL, &bOmitLocalLogging, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); ENDmodInit /* diff --git a/rsyslogd.8 b/rsyslogd.8 index 0c4fcf35..0fbe8ae1 100644 --- a/rsyslogd.8 +++ b/rsyslogd.8 @@ -29,11 +29,7 @@ rsyslogd \- reliable and extended syslogd .RB [ " \-l " .I hostlist ] -.RB [ " \-m " -.I interval -] .RB [ " \-n " ] -.RB [ " \-o " ] .br .RB [ " \-p" .IB socket @@ -180,27 +176,12 @@ Specify a hostname that should be logged only with its simple hostname and not the fqdn. Multiple hosts may be specified using the colon (``:'') separator. .TP -.BI "\-m " "interval" -The -.B rsyslogd -logs a mark timestamp regularly. The default -.I interval -between two \fI-- MARK --\fR lines is 20 minutes. This can be changed -with this option. Setting the -.I interval -to zero turns it off entirely. -.TP .B "\-n" Avoid auto-backgrounding. This is needed especially if the .B rsyslogd is started and controlled by .BR init (8). .TP -.B "\-o" -Omit reading the standard local log socket. This option is most -useful for running multiple instances of rsyslogd on a single -machine. When specified, no local log socket is opened at all. -.TP .BI "\-p " "socket" You can specify an alternative unix domain socket instead of .IR /dev/log "." diff --git a/syslogd.c b/syslogd.c index f871817a..e8b93f7c 100644 --- a/syslogd.c +++ b/syslogd.c @@ -6172,9 +6172,6 @@ int main(int argc, char **argv) NoFork = 1; break; #if 0 - case 'o': /* omit local logging (/dev/log) */ - startIndexUxLocalSockets = 1; - break; case 'p': /* path to regular log socket */ funixn[0] = optarg; break; -- cgit