Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mira.net.au!inquo!nntp.uio.no!news.maxwell.syr.edu!newsfeed.direct.ca!feed.nntp.acc.ca!newsfeeder.toronto.ican.net!news.rochester.ican.net!macwhiz From: macwhiz@phoebe.accinet.net (Rob Levandowski) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Redirecting syslog to parallel printer: best way? Date: Fri, 13 Jun 1997 22:34:31 -0500 Organization: ACC iNet (from ACC Long Distance) Lines: 34 Message-ID: <macwhiz-ya023680001306972234310001@news.accinet.net> NNTP-Posting-Host: powerbook.robl.accinet.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Warning: Spammers will be reported. X-Newsreader: Yet Another NewsWatcher 2.3.6 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:42923 As an added measure of security, I like to have a hard-copy record of my system logs. After all, it's much harder to forge a piece of paper than it is to forge /var/log/messages. :) Currently, I have an incredibly archaic Okidata Microline 90 printer for the task. (I haven't had the budget to get anything better, and it's tough scrounging a decent impact tractorfed dot matrix printer. "Impact" is a requirement because an impact printhead will leave impressions on paper if the ribbon breaks or runs out of ink; an inkjet leaves nothing if it runs out of ink on the weekend.) The printer works, in the strict sense of the term, but there are problems. Not all of the log gets printed. Occasionally, some lines are skipped -- particularly if several lines are logged quickly. My first configuration simply had a syslog.conf entry that was directed to /dev/lpt0. I discovered that this wasn't a good solution, because it didn't deal well with newsyslog. My current solution has a syslog.conf entry that captures interesting items to a specific file. Then, I have a "tail -f" process that reads that file, and pipes it into a Perl script. The Perl script simply reads a line from stdin, opens a filehandle to /dev/lpt0, prints the line, and closes the filehandle. Surely there's a better way! Ideally, I'd find a version of syslog that was designed for printer logging. However, any solution that will work with an virtually unbuffered parallel port printer is welcome. (Note, however, that the log must be emitted in realtime -- I don't want to batch this up a page at a time using lpr, or somesuch.) -- Robert Levandowski macwhiz@phoebe.accinet.net