I'm trying to log to a FIFO named pipe on FreeBSD 4.4-R, squid-2.5.PRE5.
I did "mkfifo /var/log/squid/fifolog", "chown squid:squid
/var/log/squid/fifolog",
configured Squid "cache_access_log /var/log/squid/fifolog"
I ran a small SUID perl script with owner "squid" on a virtual terminal,
and tried to start Squid. I noticed in cache.log
2002/04/15 19:50:13| logfileOpen: /var/log/squid/fifolog: (6) Device not
configured
However, I can successfully "cat file>/var/log/squid/fifolog" as root
or as a user who has rights to write to the pipe!
The contents is printed on a virtual terminal.
Note, that Squid can successfully log to a normal file
/var/log/squid/access.log
What is wrong with in logging?
Should Squid logging function to be corrected?
I cannot find a solution:
http://groups.google.com/groups?selm=9o9960%241jmm%241%40FreeBSD.csie.NCTU.e
du.tw&output=gplain
My perl script:
#!/usr/bin/perl -w
#
# Squid script
use strict;
no strict 'refs';
use Fcntl qw(:DEFAULT :flock);
use CGI::Carp qw (fatalsToBrowser);
BEGIN {
my $str=$0; $str=~ s|[^/]*$||; # Delete the filename: some non-"/", end of
line
unshift (@INC, $str); #Dir of the current script
use CGI::Carp qw(carpout);
my $LOG=$str.'error-perl.log';
open($LOG, ">>$LOG") or die "Can't open $LOG: $!\n";
carpout($LOG);
}
$|=1; # Autoflush the output buffer
#my $DATA='./fifo';
my $DATA='/var/log/squid/fifolog';
open($DATA, "<$DATA") or die "Can't open $DATA: $!\n";
my $line;
while ($line=<$DATA>)
{
print scalar(localtime).";Line received:\n$line";
sleep(1);
}
close($DATA) or die "Can't close $DATA: $!\n";
Received on Mon Apr 15 2002 - 10:17:01 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:07:34 MST