rpms/sysklogd/devel sysklogd-1.4.2rh-includeFacPri.patch, NONE, 1.1 sysklogd.spec, 1.51, 1.52

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Mar 26 10:08:39 UTC 2007


Author: pvrabec

Update of /cvs/dist/rpms/sysklogd/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv17765

Modified Files:
	sysklogd.spec 
Added Files:
	sysklogd-1.4.2rh-includeFacPri.patch 
Log Message:
include priority/facility in message


sysklogd-1.4.2rh-includeFacPri.patch:
 sysklogd.8 |    6 ++++++
 syslogd.c  |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 58 insertions(+), 4 deletions(-)

--- NEW FILE sysklogd-1.4.2rh-includeFacPri.patch ---
--- sysklogd-1.4.2rh/sysklogd.8.includeFacPri	2007-02-26 10:46:08.000000000 +0100
+++ sysklogd-1.4.2rh/sysklogd.8	2007-03-26 11:53:35.000000000 +0200
@@ -172,6 +172,12 @@
 no domain would be cut, you will have to specify two domains like:
 .BR "\-s north.de:infodrom.north.de" .
 .TP
+.B "\-S"
+Verbose logging. If specified once, the numeric facility and priority
+are logged with each locally-written message. If specified more than
+once, the names of the facility and priority are logged with each
+locally-written message.
+.TP
 .B "\-v"
 Print version and exit.
 .TP
--- sysklogd-1.4.2rh/syslogd.c.includeFacPri	2007-03-26 11:46:00.000000000 +0200
+++ sysklogd-1.4.2rh/syslogd.c	2007-03-26 11:56:50.000000000 +0200
@@ -755,6 +755,8 @@
 char	**LocalHosts = NULL;	/* these hosts are logged with their hostname */
 int	NoHops = 1;		/* Can we bounce syslog messages through an
 				   intermediate host. */
+static int	LogFacPri = 0;	/* Put facility and priority in log message: */
+				/* 0=no, 1=numeric, 2=names */
 
 extern	int errno;
 
@@ -857,7 +859,7 @@
 		funix[i]  = -1;
 	}
 
-	while ((ch = getopt(argc, argv, "46Aa:dhf:l:m:np:rs:vx")) != EOF)
+	while ((ch = getopt(argc, argv, "46Aa:dhf:l:m:np:rSs:vx")) != EOF)
 		switch((char)ch) {
                 case '4':
                               family = PF_INET;
@@ -885,6 +887,9 @@
 		case 'h':
 			NoHops = 0;
 			break;
+		case 'S':		/* log facility and priority */
+		  	LogFacPri++;   
+			break;
 		case 'l':
 			if (LocalHosts) {
 				fprintf (stderr, "Only one -l argument allowed," \
@@ -1243,7 +1248,7 @@
 
 int usage()
 {
-	fprintf(stderr, "usage: syslogd [-46Adrvxh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
+	fprintf(stderr, "usage: syslogd [-46AdiIrvxh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
 		" [-s domainlist] [-f conffile]\n");
 	exit(1);
 }
@@ -1751,7 +1756,7 @@
 	int flags;
 	char *msg;
 {
-	struct iovec iov[6];
+	struct iovec iov[7];
 	struct addrinfo *r;
 	register struct iovec *v = iov;
 	char repbuf[80];
@@ -1771,6 +1776,49 @@
 	v->iov_base = " ";
 	v->iov_len = 1;
 	v++;
+
+        if (LogFacPri) {
+	  	static char fp_buf[30];	/* Hollow laugh */
+		int fac = f->f_prevpri & LOG_FACMASK;
+		int pri = LOG_PRI(f->f_prevpri);
+		const char *f_s = NULL;
+		char f_n[5];	/* Hollow laugh */
+		const char *p_s = NULL;
+		char p_n[5];	/* Hollow laugh */
+
+		if (LogFacPri > 1) {
+		  CODE *c;
+
+		  for (c = facilitynames; c->c_name; c++) {
+		    if (c->c_val == fac) {
+		      f_s = c->c_name;
+		      break;
+		    }
+		  }
+		  for (c = prioritynames; c->c_name; c++) {
+		    if (c->c_val == pri) {
+		      p_s = c->c_name;
+		      break;
+		    }
+		  }
+		}
+		if (!f_s) {
+		  snprintf(f_n, sizeof f_n, "%d", LOG_FAC(fac));
+		  f_s = f_n;
+		}
+		if (!p_s) {
+		  snprintf(p_n, sizeof p_n, "%d", pri);
+		  p_s = p_n;
+		}
+		snprintf(fp_buf, sizeof fp_buf, "<%s.%s> ", f_s, p_s);
+		v->iov_base = fp_buf;
+		v->iov_len = strlen(fp_buf);
+	} else {
+		v->iov_base = " ";
+		v->iov_len = 1;
+	}
+	v++;
+
 	v->iov_base = f->f_prevhost;
 	v->iov_len = strlen(v->iov_base);
 	v++;
@@ -1929,7 +1977,7 @@
 		if (f->f_file == -1)
 			break;
 
-		if (writev(f->f_file, iov, 6) < 0) {
+		if (writev(f->f_file, iov, 7) < 0) {
 			int e = errno;
 
 			/* If a named pipe is full, just ignore it for now


Index: sysklogd.spec
===================================================================
RCS file: /cvs/dist/rpms/sysklogd/devel/sysklogd.spec,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- sysklogd.spec	12 Mar 2007 08:55:51 -0000	1.51
+++ sysklogd.spec	26 Mar 2007 10:08:36 -0000	1.52
@@ -1,7 +1,7 @@
 Summary: System logging and kernel message trapping daemons
 Name: sysklogd
 Version: 1.4.2
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPL
 Group: System Environment/Daemons
 URL: http://www.infodrom.org/projects/sysklogd/
@@ -14,6 +14,7 @@
 #  make create-archive
 Source: sysklogd-%{version}rh.tar.gz
 Patch1: sysklogd-1.4.2rh.timezone.patch
+Patch2: sysklogd-1.4.2rh-includeFacPri.patch
 Conflicts: logrotate < 3.5.2
 Requires: logrotate
 Requires: bash >= 2.0
@@ -35,6 +36,7 @@
 perl -pi -e 's/-fpie/-fPIE/' Makefile
 %endif
 %patch1 -p1 -b .timezone
+%patch2 -p1 -b .includeFacPri
 
 %build
 make %{?_smp_mflags}
@@ -101,6 +103,9 @@
 %{_mandir}/*/*
 
 %changelog
+* Mon Mar 26 2007 Peter Vrabec <pvrabec at redhat.com> 1.4.2-3
+- include priority/facility in message (#223573)
+
 * Mon Mar 12 2007 Peter Vrabec <pvrabec at redhat.com> 1.4.2-2
 - log in syslog own timezone (#231326)
 




More information about the fedora-cvs-commits mailing list