bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inetutils-1.4.0: please add syslogd feature


From: Michael Deutschmann
Subject: inetutils-1.4.0: please add syslogd feature
Date: Fri, 16 Aug 2002 21:56:35 -0700 (PDT)

I've switched over to your syslogd implementation from sysklogd.

Some time ago I made a private patch to sysklogd that I found quite
useful, so I immediately ported it over to your implementation.  I'd like
to have it added to the mainline code.

The patch adds a new wildcard facility "**", which covers all facilities
not already mentioned in the configuration file.  This makes it easy to
configure syslogd so no message will be lost due to being in an unexpected
facility, without creating a massive "*." logfile that would be redundant 
with any per-facility logfile.

Patch enclosed.

---- Michael Deutschmann <address@hidden>
diff -durpN inetutils-1.4.0/doc/syslogd.texi inetutils-new/doc/syslogd.texi
--- inetutils-1.4.0/doc/syslogd.texi    2001-11-10 19:40:54.000000000 -0800
+++ inetutils-new/doc/syslogd.texi      2002-08-16 21:39:49.000000000 -0700
@@ -144,7 +144,8 @@ Multiple facilities may be specified for
 them with comma (@samp{,}) characters.
 
 An asterisk (@samp{*}) can be used to specify all facilities or all
-levels.
+levels.  Two asterisks (@samp{**}) specifies all facilities not named
+previously in the configuration file.
 
 By default, a level applies to all messages with the same or higher
 level. The equal (@samp{=}) character can be prepended to a level to
diff -durpN inetutils-1.4.0/syslogd/syslogd.c inetutils-new/syslogd/syslogd.c
--- inetutils-1.4.0/syslogd/syslogd.c   2002-04-29 14:18:10.000000000 -0700
+++ inetutils-new/syslogd/syslogd.c     2002-08-16 21:35:20.000000000 -0700
@@ -135,6 +135,14 @@ typedef struct utmp UTMP;
 # include <syslog-int.h>
 #endif
 
+/* A mask of all facilities mentioned explicitly in the configuration file
+ *
+ * This is used to support a virtual facility "**" that covers all the rest,
+ * so that messages to unexpected facilities won't be lost when "*" is 
+ * not logged to a file.
+ */
+int facilities_seen;
+
 const char *ConfFile = PATH_LOGCONF; /* Default Configuration file.  */
 const char *PidFile = PATH_LOGPID; /* Default path to tuck pid.  */
 char ctty[] = PATH_CONSOLE; /* Default console to send message info.  */
@@ -1639,6 +1647,8 @@ init (int signo)
   Files = NULL;
   nextp = &Files;
 
+  facilities_seen = 0;
+
   /* Open the configuration file.  */
   cf = fopen (ConfFile, "r");
   if (cf == NULL)
@@ -1869,12 +1879,19 @@ cfline (const char *line, struct filed *
          if (*buf == '*')
            for (i = 0; i <= LOG_NFACILITIES; i++)
              {
+               /* make "**" act as a wildcard only for facilities not 
+                * specified elsewhere
+                */
+               if (buf[1] == '*' && ((1 << i) & facilities_seen))
+                 continue;
                f->f_pmask[i] &= ~pri_clear;
                f->f_pmask[i] |= pri_set;
              }
          else
            {
              i = decode (buf, facilitynames);
+             facilities_seen |= (1 << LOG_FAC(i));
+
              if (i < 0)
                {
                  snprintf (ebuf, sizeof (ebuf),

reply via email to

[Prev in Thread] Current Thread [Next in Thread]