Subject: bin/684: newsyslog(1) adds entries to the logs which have slightly different format than syslog
To: None <gnats-admin@NetBSD.ORG>
From: Thorsten Lockert <tholo@SigmaSoft.COM>
List: netbsd-bugs
Date: 01/03/1995 00:50:07
>Number:         684
>Category:       bin
>Synopsis:       newsyslog(1) adds entries to the logs which have slightly different format than syslog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan  3 00:50:03 1995
>Originator:     Thorsten Lockert
>Organization:
SigmaSoft, Th. Lockert
>Release:        1.0
>Environment:
System: NetBSD gandalf.sigmasoft.com 1.0 NetBSD 1.0 (GANDALF) #2: Sat Dec 10 15:37:24 PST 1994 root@:/usr/src/sys/arch/i386/compile/GANDALF i386
>Description:
	newsyslog(1) adds entries to both the old and new logfiles when
	rotating them (provided they are not binary files).

	However, the entries differ slightly from those added by syslogd(8)
	in that they give the weekday and the domain of the local host.
>How-To-Repeat:
	Look at eg. /var/log/messages and /var/log/messages.0.gz
>Fix:
	Apply the following patch to /usr/src/usr.bin/newsyslog/newsyslog.c:

--- newsyslog.c.orig	Sun Feb 20 01:54:45 1994
+++ newsyslog.c	Mon Jan  2 23:51:56 1995
@@ -177,7 +177,7 @@
 
         progname = argv[0];
         timenow = time((time_t *) 0);
-        daytime = ctime(&timenow);
+        daytime = ctime(&timenow) + 4;
         daytime[strlen(daytime)-1] = '\0';
 
         /* Let's find the pid of syslogd */
@@ -193,6 +193,12 @@
                 perror("gethostname");
                 (void) strcpy(hostname,"Mystery Host");
         }
+	else {
+		char *p = index(hostname, '.');
+
+		if (p)
+			*p = '\0';
+	}
 
         optind = 1;             /* Start options parsing */
         while ((c=getopt(argc,argv,"nrvf:t:")) != EOF)
>Audit-Trail:
>Unformatted: