diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-04 10:40:27 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-04 10:40:27 +0100 |
commit | 1b7f5c54684db29c096e09238648a45dce78ebee (patch) | |
tree | 7db5f2d5ea45b53109b0f9f585fca845fa0773fe /tools/syslogd.c | |
parent | b41e0d51f54a89f489bbf1c1bf5f85d576ae4049 (diff) | |
download | rsyslog-1b7f5c54684db29c096e09238648a45dce78ebee.tar.gz rsyslog-1b7f5c54684db29c096e09238648a45dce78ebee.tar.bz2 rsyslog-1b7f5c54684db29c096e09238648a45dce78ebee.zip |
moved rfc3164/5424 code to new parser modules
another milestone commit: the program works, the new interface
is used, some more cleanup is needed and the per-ruleset config
options are still missing. But we are getting closer...
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r-- | tools/syslogd.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index aeab292c..5b7f1e65 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -33,7 +33,7 @@ * to the database). * * rsyslog - An Enhanced syslogd Replacement. - * Copyright 2003-2008 Rainer Gerhards and Adiscon GmbH. + * Copyright 2003-2009 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -126,6 +126,7 @@ #include "omfile.h" #include "omdiscard.h" #include "pmrfc5424.h" +#include "pmrfc3164.h" #include "threads.h" #include "wti.h" #include "queue.h" @@ -346,7 +347,6 @@ static char **crunch_list(char *list); static void reapchild(); static void debug_switch(); static void sighup_handler(); -static void processImInternal(void); static int usage(void) @@ -600,6 +600,7 @@ msgConsumer(void __attribute__((unused)) *notNeeded, batch_t *pBatch, int *pbShu { int i; msg_t *pMsg; + rsRetVal localRet; DEFiRet; assert(pBatch != NULL); @@ -608,9 +609,12 @@ msgConsumer(void __attribute__((unused)) *notNeeded, batch_t *pBatch, int *pbShu pMsg = (msg_t*) pBatch->pElem[i].pUsrp; DBGPRINTF("msgConsumer processes msg %d/%d\n", i, pBatch->nElem); if((pMsg->msgFlags & NEEDS_PARSING) != 0) { - parser.ParseMsg(pMsg); + localRet = parser.ParseMsg(pMsg); + if(localRet == RS_RET_OK) + ruleset.ProcessMsg(pMsg); + } else { + ruleset.ProcessMsg(pMsg); } - ruleset.ProcessMsg(pMsg); /* if we reach this point, the message is considered committed (by definition!) */ pBatch->pElem[i].state = BATCH_STATE_COMM; } @@ -1738,7 +1742,7 @@ void sigttin_handler() * really help us. TODO: add error messages? * rgerhards, 2007-08-03 */ -static void processImInternal(void) +static inline void processImInternal(void) { int iPri; msg_t *pMsg; @@ -1888,6 +1892,11 @@ static rsRetVal loadBuildInModules(void) /* load build-in parser modules */ CHKiRet(module.doModInit(modInitpmrfc5424, UCHAR_CONSTANT("builtin-pmrfc5424"), NULL)); + CHKiRet(module.doModInit(modInitpmrfc3164, UCHAR_CONSTANT("builtin-pmrfc3164"), NULL)); + + /* and set default parser modules (order is *very* important, legacy (3164) parse needs to go last! */ + CHKiRet(parser.AddDfltParser(UCHAR_CONSTANT("rsyslog.rfc5424"))); + CHKiRet(parser.AddDfltParser(UCHAR_CONSTANT("rsyslog.rfc3164"))); /* ok, initialization of the command handler probably does not 100% belong right in * this space here. However, with the current design, this is actually quite a good |