[Mimedefang] Re: MIMEDefang digest, Vol 1 #531 - 14 msgs

Brent J. Nordquist b-nordquist at bethel.edu
Fri Jan 31 10:24:00 EST 2003


On Thu, 30 Jan 2003, John Kirkland <jpk at bl.org> wrote:

> 1. have an
> ignore-max-time-and-load-the-file-anyways-cuz-I-know-what-I-am-doing
> flag.
> [...]
> If you or someone were to add these features to graphdefang, I would
> gladly add them to the source.

The attached patch adds this flag, and seems to work.  Also available here
in case this list doesn't take attachments:

	http://kepler.acns.bethel.edu/~bjn/graphdefang/nomax.patch

> 2. since the syslog file contains the hostname, I could track the max
> time by hostname so that you can load files from different hosts even
> without the log rotation that you are doing.

This one sounds interesting to me also.

-- 
Brent J. Nordquist <b-nordquist at bethel.edu> N0BJN
Other contact information: http://kepler.acns.bethel.edu/~bjn/contact.html
-------------- next part --------------
--- graphdefang.pl.orig	Wed Jan 22 08:36:23 2003
+++ graphdefang.pl	Fri Jan 31 08:07:41 2003
@@ -34,6 +34,7 @@
 $QUIET = 0;	# No output
 $NODB = 0;	# Don't use SummaryDB, just produce charts from logfile
 my $trim = 0;	# Trim database
+my $nomax = 0;	# Ignore max date/time
 my $help = 0;	# Show help?
 my $man = 0;	# Show bigger help?
 my $file;	# Log file to parse (optional)
@@ -41,6 +42,7 @@
 GetOptions( 	'quiet'  => \$QUIET,
 		'nodb' 	 => \$NODB,
 		'trim'   => \$trim,
+		'nomax'  => \$nomax,
 		'help|?' => \$help,
 		'man'	 => \$man,
 		'file=s' => \$file ) or pod2usage(2);;
@@ -79,7 +81,7 @@
 
 # Open DATAFILE and Summarize It
 
-my %DataSummary = read_and_summarize_data($DATAFILE)
+my %DataSummary = read_and_summarize_data($DATAFILE, $nomax)
         or die "No valid mimedefang logs in $DATAFILE";
 
 print STDERR "Processing graphs\n" if (!$QUIET);
@@ -105,6 +107,7 @@
   --quiet           quiet output
   --nodb            do not update SummaryDB
   --trim            trim the SummaryDB
+  --nomax           ignore the max date/time in SummaryDB
   --file            optional log file to parse
 
 If called with no options, graphdefang.pl will parse the
@@ -138,6 +141,11 @@
 3.  all but top 25 sender, recipient, value1, value2, subject values
     for all dates prior to the current hour, day, and month..
 
+=item B<--nomax>
+
+Ignore the max date/time in the SummaryDB; add all lines from the parsed
+file to the database.
+
 =item B<--file>
 
 Optional log file to parse.  If this option is not set, graphdefang
--- graphdefanglib.pl.orig	Wed Jan 22 08:36:23 2003
+++ graphdefanglib.pl	Fri Jan 31 08:05:16 2003
@@ -171,8 +171,9 @@
 		or die "Can't unlink $SUMMARYDB.bak:$!\n";
 }
 
-sub read_and_summarize_data($) {
+sub read_and_summarize_data($$) {
         my $fn = shift;
+        my $nomax = shift;
         my %data = ();
 	my %data_db = ();
 
@@ -197,7 +198,7 @@
 
 	# Get max unixtime value from DBM file 
 	my $MaxDBUnixTime = 0;
-	$MaxDBUnixTime = $data{'max'} if (defined($data{'max'}));
+	$MaxDBUnixTime = $data{'max'} if (!$nomax && defined($data{'max'}));
 
 	print STDERR "\tMax Unixtime from SummaryDB:  $MaxDBUnixTime\n" if (!$QUIET and !$NODB);
 


More information about the MIMEDefang mailing list