Bug#705215: logger: logs locally, even when told to write to remote syslog server

2013-04-11 Thread Frank Thilo
Package: bsdutils
Version: 1:2.20.1-5.3

Hi,

the logger tool from bsdutils comes with an option (-n / --server) for
logging to a remote syslog server (via UDP port 514 by default), e.g.:

  logger -n myloghost -p local0.info test log message

However, the message never arrives at myloghost but is instead written to
the local syslog.

I have debugged the issue and found that there are 5 branches in the code
for deciding whether to call syslog(3) or use a socket for sending the
message. The first 3 use 'if (!usock  !udpserver)' while the latter two
incorrectly use 'if (!usock)'. The attached patch fixes this.

-- 
Frank Thilo - th...@unix-ag.orgIRC: Chestal
--- logger.c	2013-04-11 13:30:48.0 +0200
+++ logger.c.fixed	2013-04-11 13:30:48.0 +0200
@@ -281,7 +281,7 @@
 			}
 		}
 		if (p != buf) {
-		if (!usock)
+		if (!usock  !udpserver)
 			syslog(pri, %s, buf);
 		else
 			mysyslog(LogSock, logflags, pri, tag, buf);
@@ -295,7 +295,7 @@
 		if (len  0  buf[len - 1] == '\n')
 			buf[len - 1] = '\0';
 
-		if (!usock)
+		if (!usock  !udpserver)
 			syslog(pri, %s, buf);
 		else
 			mysyslog(LogSock, logflags, pri, tag, buf);


Bug#705217: logger: missing HOSTNAME field in HEADER part of syslog packet

2013-04-11 Thread Frank Thilo
Package: bsdutils
Version: 1:2.20.1-5.3

Hi,

when logging to a remote server with the logger tool (see Bug #705215 to
make it work in the first place), the message format does not seem to adhere
to RFC 3164 (which I guess is what logger wants to produce). The RFC states
that the HEADER part 'contains a timestamp and an indication of the
hostname or IP address of the device'. The message that logger creates is
missing the hostname part. Instead, the timestamp is immediately followed by
the MSG part (which itself starts with the TAG field):

--
hostA logger -n hostB -P 6543 -p local0.info -t mytag 'just a test'

hostB nc -u -l -p 6543
134Apr 11 14:07:56 mytag: just a test
--

My understanding is that the message should look like this instead:
  134Apr 11 14:07:56 hostA mytag: just a test


When logging to rsyslogd, the message actually works without the hostname
field; rsyslog seems to do a reverse lookup on the originating ip address
and fill that in. I can also fake the hostname field by using
-t 'myhost mytag'.

-- 
Frank Thilo - th...@unix-ag.orgIRC: Chestal


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org