summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-09-09 13:36:06 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-09-09 13:36:06 +0000
commit5b58b4f72e07239c823a8291c4fa91adcea8a9ad (patch)
tree513ae576740d06bd720d898b01cac5c3c0014c67
parent9a39532d953ac2a486635316ffd1970c993753de (diff)
downloadrsyslog-5b58b4f72e07239c823a8291c4fa91adcea8a9ad.tar.gz
rsyslog-5b58b4f72e07239c823a8291c4fa91adcea8a9ad.tar.xz
rsyslog-5b58b4f72e07239c823a8291c4fa91adcea8a9ad.zip
added DISCARD action to selector lines
-rw-r--r--NEWS3
-rw-r--r--syslogd.c26
2 files changed, 27 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6cebe72e..4b15c91c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@
Version 1.10.0 (RGer), 2005-09-??
REMINDER: 1.10 is the first unstable version if the 1.x series!
- changed stringbuf into a new counted string class
+- added support for a "discard" action. If a selector line with
+ discard (~ character) is found, no selector lines *after* that
+ line will be processed.
---------------------------------------------------------------------------
Version 1.0.0 (RGer), 2005-09-12
- changed install doc to cover daily cron scripts - a trouble source
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<<prilev)) == 0) )
continue;
+ /* We now need to check a special case - F_DISCARD. If that
+ * action is specified in the selector line, no futher processing
+ * must be done. Thus, we stop the for-loop.
+ * 2005-09-09 rgerhards
+ */
+ if(f->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