Tested successfully with:
# Mod_perl testing...
# Send Webmaster ([EMAIL PROTECTED]) e-mail when 'events' occur...
<Location />
PerlLogHandler Apache::LogMail
PerlSetVar LogMailto [EMAIL PROTECTED]
PerlSetVar LogPattern \.(cgi|htm?|shtm?|txt)$
</Location>
using Apache::LogMail.pm -
# From: Mod Perl <[EMAIL PROTECTED]>
# To: [EMAIL PROTECTED]
# Subject: Somebody looked at /~kryan/guestbook.txt
# Date: Thu, 27 Aug 1998 08:14:23 -0400
#
# At Thu Aug 27 08:14:23 1998, a user at 192.168.2.1 looked at
# /~kryan/guestbook.txt using the Mozilla/4.04 [en] (X11; I; Linux
# 2.0.33 i686) browser.
#
# The request was GET /~kryan/guestbook.txt HTTP/1.0,
# which resulted returned a code of 200 OK.
#
# 462 bytes were transferred.
package Apache::LogMail;
# File: Apache/LogMail.pm
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
my $mailto = $r->dir_config('LogMailto');
return DECLINED unless $mailto;
my $filepattern = $r->dir_config('LogPattern');
return DECLINED if $filepattern
&& $r->filename !~ /$filepattern/;
my $request = $r->the_request;
my $uri = $r->uri;
my $agent = $r->header_in("User-agent");
my $bytes = $r->bytes_sent;
my $remote = $r->get_remote_host;
my $status = $r->status_line;
my $date = localtime;
my $server_name = $r->get_server_name;
my $from = $r->server->server_admin || "webmaster";
local $ENV{PATH}; #keep -T happy
unless (open MAIL, "|/usr/lib/sendmail -oi -t") {
$r->log_error("Couldn't open mail: $!");
return DECLINED;
}
print MAIL <<END;
To: $mailto
From: mod_perl httpd <$from>
Subject: Somebody looked at $uri
For FCCJ Virtual WWW Server: $server_name
At $date, a user at $remote looked at
$uri using the $agent browser.
The request was $request,
which resulted returned a code of $status.
$bytes bytes were transferred.
END
close MAIL;
return OK;
}
1;
__END__
Thx! -Sneex :]
____________________________________________________________________
Bill Jones * Systems Programmer * http://www.fccj.org/cgi/mail?sneex
('> Running -
//\ Perl, Apache, MySQL, PHP3,
v_/_ Ultra 10, LinuxPPC, BeOS...
> From: Bill Jones <[EMAIL PROTECTED]>
> Date: Mon, 31 Jan 2000 12:02:51 -0500
> To: <[EMAIL PROTECTED]>
> Subject: Re: Compiling mod_perl as a DSO?
>
> After much fighting - 2/3 success :/ Better than nothing :]
>
>> Server Version: Apache/1.3.12-dev (Unix) mod_perl/1.21_01-dev
>> Server Built: Jan 31 2000 10:55:04
>> API Version: 19990320:6
>> Run Mode: standalone
>> User/Group: sneex(69)/69
>> Hostname/port: insecurity.org:80
>> Daemons: start: 5 min idle: 5 max idle: 10 max: 150
>> Max Requests: per child: 0 keep alive: on max per connection: 100
>> Threads: per child: 0
>> Excess requests: per child: 0
>> Timeouts: connection: 300 keep-alive: 15
>> Server Root: /usr/local/apache
>> Config File: conf/httpd.conf
>> PID File: /usr/local/apache/logs/httpd.pid
>> Scoreboard File: /usr/local/apache/logs/httpd.scoreboard
>
>
> Integrating PHP4 is my next battle - wish me luck...
>
> Thanks to all who helped! -Sneex- :]