Tuesday 4 August 2009

EZMLM Log File Viewer

DJB's EZMLM mailing list software keeps a log showing subscriber additions and deletions, but the date and time are in a non-human-readable format.  Here's a script to view those logs...

A while back, I found a Perl script somewhere to display the log properly. Now I've tweaked it slightly so that the output includes any extra info passed to "ezmlm-sub -n" when the subscriber was added. I can't find the original source now, but here's my changed version.
cat /usr/local/sbin/ezmlm-logview.pl
#!/usr/bin/perl -w
use strict;
if ($#ARGV != 0) {
 print "usage: ezmlm-logview /home/owner/listdir \n";
 exit;
}
my $log = "$ARGV[0]/Log";
open LOG, "<$log" or die "$log: open: $!\n";
my @F;
while () {
 @F = split;
 print scalar(localtime $F[0]);

 for (my $count=1; $count <= scalar(@F)-1; $count++)
 {
  my $field = $F[$count];
  print "$field ";
 }
 print "\n";
}

No comments:

Post a Comment

Spammers: please stop wasting my time. All comments are moderated before publication.