develooper Front page | perl.beginners | Postings from October 2009

Something silly I'm not seeing.. flt script is written to.

Thread Next
Harry Putnam
October 17, 2009 00:02
Something silly I'm not seeing.. flt script is written to.
Message ID:
I wrote a quick filter for system-log output but must have done
something really dumb because syslog is writing to the script (through
a named-pipe).

This is on opensolaris... The system logger syslog.conf file doesn't
allow the use of a pipe symbol like can be done on linux OS's, for
sending syslog output to a named pipe.

The script opens the named-pipe for reading

But the data is actually being written into the script.  Egad... that
seems pretty crazy.  When I start the script with `./flt' it does not
write to any files... or to stdout, instead the data is coming through
the named-pipe and being written into the script file.  The data is
being appended to the script instead of the expected files.

I think I must have gotten a variable confused in there but I'll be
damned if I can see it.

Also wondered if there might be something peculiar about the
named-pipe so running `file slpipe'... it shows:

   # file slpipe
  slpipe:         fifo

As expected.

Here is the script... I've looked hard at it but not seeing why this
is happening (The extra prints were there just to see if any data was
coming through):


use strict;
use warnings;

my $idmap_rgx = qr/ idmap\[\d+\]:/;
my $sshd_rgx = qr/ sshd*\[\d+\]:/;

my $sshd_log  = '/var/adm/sshd.log';
my $idmap_log = '/var/adm/idmap.log';
my $pipe = '/var/adm/slpipe';

open(SSHD_LOG,">> $sshd_log")or die "Can't open $sshd_log: $!";
open(IDMAP_LOG,">> $idmap_log")or die "Can't open $idmap_log: $!";

if (open(PIPE, "<$pipe")) {
   while (<PIPE>) {
         print IDMAP_LOG $_;
         print SSHD_LOG $_;

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About