[plug] Syslog daemons

Anthony J. Breeds-Taurima tony at cantech.net.au
Wed Jan 9 15:31:07 WST 2002


On Wed, 9 Jan 2002 craig at postnewspapers.com.au wrote:

> > I do just this for about 30 HP printers.
> *yell of delight*
> HOW?!? I have 2 HP4MVs on the network here and haven't been able to
> persuade them to do it, though I'd heard they could. What tools etc
> needed?

Use telnet (on the printer) to set the syslog facility (If you can't then it
will just mean the the perl script takes longer to run).

Make sure the syslod daemon is accepting remote logs (-r)

----
#!/usr/bin/perl -w

use strict;

my $hostname='syslog'; #NOT the FQDN

@ARGV=qw(/full/path/to/file);
#ie /var/log.messages

while (<>) {
	# You should be able to drop this if your printer support syslog
	# facilities correctly.
	# <dropable>
	study;
	next if (/ $hostname /io);
	next if (/ kernel /i);
	next if (/ localhost /i);
	# </dropable>
	# Grab the printername/ip
	/:\d\d ([^ ]) /;
	my $printer=$1;
	print "$printer says: $_";
}
----

This is not the best script but should give you an idea of how to attack it.

Yours Tony.

/*
 * "The significant problems we face cannot be solved at the 
 * same level of thinking we were at when we created them."
 * --Albert Einstein
 */



More information about the plug mailing list