From e868864af07febc5755735d451d74d9bc3ba170d Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Mon, 10 Mar 2008 20:25:23 -0600
Subject: [PATCH] Fixed bug in parsing snapshot total logs

---
 zfs-log-parser | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/zfs-log-parser b/zfs-log-parser
index 5c28003..dbb3c15 100755
--- a/zfs-log-parser
+++ b/zfs-log-parser
@@ -94,6 +94,7 @@ sub parse_snapshot_totals_logfile {
     $header="";
     while(<FILE>) {
 	$line = $_;
+        if($line =~ /logfile turned over/) { next; }
 	if(($in_totals == 0) && ($line =~ /(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\S+)\s+(\S+)/)) {
 	    $dayname=$1; $month=$2; $daynum=$3; $hour=$4; $minute=$5; $sec=$6; $year=$8;
 	    $in_totals = 1;
@@ -103,10 +104,10 @@ sub parse_snapshot_totals_logfile {
 	    if(!defined $founddates{$date}) { $header .= $date . " "; }
 	    $founddates{$date} = 1;
 	}
-	if(($in_totals == 1) && ($line =~ /^\s+$/)) {
+	elsif(($in_totals == 1) && ($line =~ /^\s+$/)) {
 	    $in_totals = 0;
 	}
-	if(($in_totals == 1) && ($line =~ /(\S+)\s+([\d\.]+)(\w+)\s+(\d+)/)) {
+	elsif(($in_totals == 1) && ($line =~ /(\S+)\s+([\d\.]+)(\w+)\s+(\d+)/)) {
 	    $filesystem = $1; $data = $2; $size = $3; $num_snaps = $4;
 	    if($filesystem =~ /Snapshots/) { next; }
 	    if($filesystem =~ /$backup_pool/) { next; }
-- 
2.34.1