Ged Haywood wrote:
> Hi there,
>
> On Thu, 6 Dec 2001, Lance Uyehara wrote:
>
>
>>ErrorLog syslog
>>
>
> Are you sure you want to do this?
>
>
>>How do I get the warnings when syslog is used?
>>
>
> There are some tips in Stas Bekman's new book, not yet published
> (you'll have to become a reviwer:) and you will find some help in the
> guide -- http://perl.apache.org/guide/porting.html#Apache_and_syslog
Too many people suggested that we plunge the syslog section because of
its slowness and unreliability. You should use log_spread instead if you
need to collect logs from many machines.
Since this section ss probably going away, here it is:
The syslog solution can be implemented using the following
configuration:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "| /usr/local/apache/bin/syslogger.pl hostnameX" common
where a simple I<syslogger.pl> can look like this:
syslogger.pl
------------
#!/usr/bin/perl
use Sys::Syslog qw(:DEFAULT setlogsock);
my $hostname = shift || 'localhost';
my $priority = 'ndelay'; # open the connection immediately
my $facility = 'local0'; # one of local0..local7
my $priority = 'info'; # debug|info|notice|warning|err...
setlogsock 'unix';
openlog $hostname, $priority, $facility;
while (<>) {
chomp;
syslog $priority, $_;
}
closelog;
The syslog utility needs to know the facility to work with and the
logging level. We will use C<local0>, one of the special logging
facilities reserved for local usage (eight local facilities are
available: local0 to local7). We will use the C<info> priority level
(again one of eight possible levels: I<debug>, I<info>, I<notice>,
I<warning>, I<err>, I<crit>, I<alert>, I<emerg>).
Now make the syslog utility on the master machine (where all logs are
to be stored) log all messages coming from facility C<local0> with
logging level C<info> to a file of our choice. This is achieved by
editing the I</etc/syslog.conf> file. For example:
local0.info /var/log/web/access_log
All other machines forward their logs from facility C<local0> to the
central machine, therefore on all but the master machine we add the
forwarding directive to the I</etc/syslog.conf> file (assuming that
the master machine's hostname is C<masterhost>):
local0.info @masterhost
We must restart the syslogd(8) daemon or send it the C<-HUP> kill
signal for the changes to take effect before the logger can be used.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/