tech-userlevel archive

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

Re: syslog message with wrong date, and patch for newsyslog



On Mon, Jan 12, 2015 at 09:23:30AM -0600, Jeremy C. Reed wrote:
 > My syslog had been dead for a few days. (I saw some cronjob mail about 
 > newsyslog unable to kill.)
 > 
 > Today I looked at some logs and saw no updates for a week. So I saw 
 > syslogd not running. I started it and immediately logged:
 > 
 > Jan 12 09:08:29 t1 syslogd[17678]: restart
 > Jan 12 09:08:29 t1 /netbsd: UVM: pid 4690 (vi), uid 1000 killed: out of 
 > swap
 > Jan 12 09:08:29 t1 /netbsd: UVM: pid 156 (syslogd), uid 0 killed: out of 
 > swap
 > 
 > (I know this vi crash was due to editing with vi -r. I am pretty sure 
 > this is fixed now but cannot find the gnats ticket number.)
 > 
 > So the last two messages with today's timestamps really happened maybe 
 > on January 6.

I don't remember exactly how the kernel message buffer -> syslogd
interface works, but it wouldn't surprise me if syslogd applied the
timestamps, in which case what you see is expected (the entries get
stamped when found)... just maybe not optimal.

 > By the way, a couple days ago I updated my newsyslog with:
 > 
 > Index: newsyslog.c
 > ===================================================================
 > RCS file: /cvsroot/src/usr.bin/newsyslog/newsyslog.c,v
 > retrieving revision 1.61
 > diff -u -r1.61 newsyslog.c
 > --- newsyslog.c	5 Sep 2013 11:34:40 -0000	1.61
 > +++ newsyslog.c	12 Jan 2015 15:12:25 -0000
 > @@ -623,7 +623,9 @@
 >  			    sys_signame[log->signum], (u_long)pid));
 >  			if (!noaction)
 >  				if (kill(pid, log->signum))
 > -					warn("kill");
 > +					warn("kill -%s %lu",
 > +						sys_signame[log->signum],
 > +						(u_long)pid);
 >  		}
 >  	}
 >  
 > 
 > I now see my email has:
 > 
 >    From: root (Cron Daemon)
 >    To: root
 >    Subject: Cron <root@t1> /usr/bin/newsyslog
 > 
 >    newsyslog: kill -HUP 156: No such process
 > 
 > Now I see that "156" is the same as logged above.
 > 
 > Okay if I commit that minor change? Or will that break it for someone 
 > relying on the terse "newsyslog: kill: No such process" output?

Very unlikely. Please commit...

(except, please use strsignal() rather than sys_signame[])

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index