Paul, 

Thank you for the log sample! I have attached a patch that updates the
pattern matching for the moin event log processing for your review.

I do not believe the rotate-logs script is responsible for the malformed
entries you are seeing. It also appears the original author was seeing
the errors, too, as indicated by a specific else clause meant to disgard such
occurrences: 

163: print "Ignoring malformed log line #" .$fh_in->input_line_number() . ": 
$line\n";

This particular clause was not being triggered due to the original regex
being a bit too greedy resulting in malformed timestamps being passed to
gmtime(). 

The attached patch corrects the issue, but the script could use some
additional tidying up as it does have a few 'magic
numbers' scattered about which took some extra time for me to discern
their meaning. I didn't want to get too liberal with the modifications 
and end up in refactor territority when all that was asked was to make
the errors go away :) 

-- 
James Montgomery
>From 5db19f4426a99e4b9c52491df2cad23afee26129 Mon Sep 17 00:00:00 2001
From: James Montgomery <ja...@onedev.org>
Date: Mon, 18 Sep 2017 21:11:34 -0400
Subject: [PATCH] Update regex match

---
 bin/rotate-logs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/rotate-logs b/bin/rotate-logs
index 532e9a8..c171836 100755
--- a/bin/rotate-logs
+++ b/bin/rotate-logs
@@ -250,7 +250,7 @@ $gid = get_gid_by_name("wikiweb");
 chdir $moin_logdir or die "Can't cd to $moin_logdir: $!\n";
 
 rotate_log("edit-log", '^(\d+)\s+(\d+)\s+(\S+)\s+(\S)+\s+(\S+)', 'moin');
-rotate_log("event-log", '^(\d+)\s+(\S+)\s+(\S+)', 'moin');
+rotate_log("event-log", '^(\d{0,16})\s+(\S+)\s+(\S+)', 'moin');
 
 chdir $local_logdir or die "Can't cd to $local_logdir: $!\n";
 
-- 
2.14.1

Reply via email to