summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-09 08:25:25 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-09 08:25:25 +0000
commitfbd4ecdce40d1164c7cbdd55c672a83755e95482 (patch)
treed2e75ea5c1db839157e0e216685640a2e15451f7 /syslogd.c
parent0964658cc8a276bbdfce335d08898ee4097e87dc (diff)
downloadrsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.tar.gz
rsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.tar.xz
rsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.zip
- implemented new GetSize() handler for config files
- implemented $MainMsgQueueMaxFileSize configuration directive
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/syslogd.c b/syslogd.c
index 79a0caa0..72edb732 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -381,6 +381,7 @@ static int logEveryMsg = 0;/* no repeat message processing - read-only after st
*/
uchar *pszSpoolDirectory = NULL;/* name of rsyslog's spool directory (without trailing slash) */
uchar *pszMainMsgQFilePrefix = NULL;/* prefix for the main message queue file */
+size_t iMainMsgQueMaxFileSize = 1024*1024;
/* end global config file state variables */
static unsigned int Forwarding = 0;
@@ -519,6 +520,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
pszMainMsgQFilePrefix = NULL;
}
iMainMsgQueueSize = 10000;
+ iMainMsgQueMaxFileSize = 1024 * 1024;
iMainMsgQueueNumWorkers = 1;
MainMsgQueType = QUEUETYPE_FIXED_ARRAY;
@@ -3357,6 +3359,12 @@ init(void)
fprintf(stderr, "fatal error %d: could not create message queue - rsyslogd can not run!\n", iRet);
exit(1);
}
+ /* ... set some properties ... */
+ CHKiRet_Hdlr(queueSetMaxFileSize(pMsgQueue, iMainMsgQueMaxFileSize)) {
+ logerrorInt("Invalid $MainMsgQueueMaxFileSize, error %d. Ignored, running with default setting", iRet);
+ }
+
+ /* ... and finally start the queue! */
CHKiRet_Hdlr(queueStart(pMsgQueue)) {
/* no queue is fatal, we need to give up in that case... */
fprintf(stderr, "fatal error %d: could not start message queue - rsyslogd can not run!\n", iRet);
@@ -4278,17 +4286,17 @@ dbgprintf(char *fmt, ...)
* rgerhards, 2007-06-15
*/
if(bWasNL) {
- //fprintf(stdout, "%8.8x: ", (unsigned int) pthread_self());
- fprintf(stderr, "%8.8x: ", (unsigned int) pthread_self());
+ fprintf(stdout, "%8.8x: ", (unsigned int) pthread_self());
+ //fprintf(stderr, "%8.8x: ", (unsigned int) pthread_self());
}
bWasNL = (*(fmt + strlen(fmt) - 1) == '\n') ? TRUE : FALSE;
va_start(ap, fmt);
- //vfprintf(stdout, fmt, ap);
- vfprintf(stderr, fmt, ap);
+ vfprintf(stdout, fmt, ap);
+ //vfprintf(stderr, fmt, ap);
va_end(ap);
- fflush(stderr);
- //fflush(stdout);
+ //fflush(stderr);
+ fflush(stdout);
return;
}
@@ -4496,6 +4504,7 @@ static rsRetVal loadBuildInModules(void)
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuesize", 0, eCmdHdlrInt, NULL, &iMainMsgQueueSize, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetype", 0, eCmdHdlrGetWord, setMainMsgQueType, NULL, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkerthreads", 0, eCmdHdlrInt, NULL, &iMainMsgQueueNumWorkers, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuemaxfilesize", 0, eCmdHdlrSize, NULL, &iMainMsgQueMaxFileSize, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"repeatedmsgreduction", 0, eCmdHdlrBinary, NULL, &bReduceRepeatMsgs, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlywhenpreviousissuspended", 0, eCmdHdlrBinary, NULL, &bActExecWhenPrevSusp, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionresumeinterval", 0, eCmdHdlrInt, setActionResumeInterval, NULL, NULL));