From 5b58b4f72e07239c823a8291c4fa91adcea8a9ad Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 9 Sep 2005 13:36:06 +0000 Subject: added DISCARD action to selector lines --- syslogd.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'syslogd.c') diff --git a/syslogd.c b/syslogd.c index 12876153..ed422fae 100644 --- a/syslogd.c +++ b/syslogd.c @@ -510,10 +510,11 @@ int repeatinterval[] = { 30, 60 }; /* # of secs before flush */ #define F_FORW_UNKN 8 /* unknown host forwarding */ #define F_PIPE 9 /* named pipe */ #define F_MYSQL 10 /* MySQL database */ +#define F_DISCARD 11 /* discard event (do not process any further selector lines) */ char *TypeNames[] = { "UNUSED", "FILE", "TTY", "CONSOLE", "FORW", "USERS", "WALL", "FORW(SUSPENDED)", - "FORW(UNKNOWN)", "PIPE", "MYSQL" + "FORW(UNKNOWN)", "PIPE", "MYSQL", "DISCARD" }; struct filed *Files = NULL; @@ -3139,7 +3140,7 @@ void logmsgInternal(pri, msg, from, flags) * if not, we use emergency logging to the console and in * this case, no further decoding happens. * changed to no longer receive a plain message but a msg object instead. - * rgerhards-2994-11-16: OK, we are now up to another change... This method + * rgerhards-2004-11-16: OK, we are now up to another change... This method * actually needs to PARSE the message. How exactly this needs to happen depends on * a number of things. Most importantly, it depends on the source. For example, * locally received messages (SOURCE_UNIXAF) do NOT have a hostname in them. So @@ -3325,11 +3326,27 @@ void logmsg(pri, pMsg, flags) for (f = Files; f; f = f->f_next) { + /* This is actually the "filter logic". Looks like we need + * to improve it a little for complex selector line conditions. We + * won't do that for now, but at least we now know where + * to look at. + * 2005-09-09 rgerhards + */ /* skip messages that are incorrect priority */ if ( (f->f_pmask[fac] == TABLE_NOPRI) || \ ((f->f_pmask[fac] & (1<f_type == F_DISCARD) { + dprintf("Discarding message based on selector config\n"); + break; /* that's it for this message ;) */ + } + if (f->f_type == F_CONSOLE && (flags & IGN_CONS)) continue; @@ -5223,6 +5240,11 @@ void cfline(line, f) dprintf(" template '%s'\n", szTemplateName); break; + case '~': /* rgerhards 2005-09-09: added support for discard */ + dprintf ("discard"); + f->f_type = F_DISCARD; + break; + case '>': /* rger 2004-10-28: added support for MySQL * >server,dbname,userid,password * rgerhards 2005-08-12: changed rsyslogd so that -- cgit