On Tue, May 25, 1999 at 05:26:32PM +0200, Per Steinar Iversen wrote:
> Another utility from sendmail that I miss is hoststat.
A "poor man's version" that I just knocked together in a few minutes (so
no criticising the coding style, please) is below. I hope it's useful to
someone. All improvements welcome.
Dave
#!/usr/bin/perl
# exihoststat
# needs "log_smtp_confirmation = true" in exim.conf
# reads mainlog on stdin
# Dave Holland 25 May 1999
use English;
use FileHandle;
format OUT_TOP =
Hostname When Result
---------------------------------------------------------------------------
.
format OUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$h, $w, $r
.
while(<>)
{
next unless m/[-=]\>/ ;
$host=undef;
if (m/(\d\d:\d\d:\d\d).*[-=]\>.* H=(\S+) .* C="([\w\s]+)"/)
{ $when=$1; $host=$2; $comment=$3; }
if (defined $host) { $c{$host}=$comment; $w{$host}=$when; }
}
format_name STDOUT "OUT";
format_top_name STDOUT "OUT_TOP";
foreach(sort(keys(%c))) { $h=$_; $w=$w{$_}; $r=$c{$_}; write; }
--
*** Exim information can be found at
http://www.exim.org/ ***