Index: /trunk/arclog/arclog.pl
===================================================================
--- /trunk/arclog/arclog.pl	(revision 17270)
+++ /trunk/arclog/arclog.pl	(revision 17271)
@@ -95,4 +95,41 @@
 }
 
+# figure out the last record that we saw
+# since the order in the sqllite db isn't guarenteed and we can't sort in the
+# db, we have to do this by hand
+my $last_recorded_time;
+{
+    my $strptime = DateTime::Format::Strptime->new(
+        pattern => '%Y-%m-%dT%H:%M:%S'
+    );
+
+    # read in the entire database
+    my $query = $dbh->prepare("SELECT * FROM log")
+    or die "database error: $!";
+    $query->execute or die "database error: $!";
+    my $records = $query->fetchall_arrayref;
+
+    # sort it for the latest timestamp
+    foreach my $rec (@$records) {
+        my ($host, $time, $device, $event, $elapse_time, $errors)
+            = split(/\|/, $rec->[0]);
+
+        my $dt = $strptime->parse_datetime($time);
+
+        if (! defined $last_recorded_time) {
+            $last_recorded_time = $dt;
+        } elsif ($dt > $last_recorded_time) {
+            $last_recorded_time = $dt;
+        }
+
+    }
+
+#    warn "latest timestamp is: $last_recorded_time\n";
+
+    unless (defined $last_recorded_time) {
+        warn "failed to determine the time of the last recorded record\n";
+    }
+}
+
 #use Data::Dumper;
 #print Dumper(\@records);
@@ -120,5 +157,8 @@
         next RECORDS if $event =~ /$filter/;
     }
-    print "$host $time $device $event $elapse_time $errors\n";
+    
+    if ($time > $last_recorded_time) {
+        print "$host $time $device $event $elapse_time $errors\n";
+    }
 
     use warnings;
