X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=zfs-log-parser;h=c277e142bf63cc094e0a6657dfc22831d8be80da;hb=84dd3e2aec7bf7c4c61a3cc0deef0e37e2ee3412;hp=dbb3c15a88a8e533a05ad30593c35755d84a0c7b;hpb=e868864af07febc5755735d451d74d9bc3ba170d;p=zfs-ubuntu%2F.git diff --git a/zfs-log-parser b/zfs-log-parser index dbb3c15..c277e14 100755 --- a/zfs-log-parser +++ b/zfs-log-parser @@ -91,10 +91,13 @@ sub parse_snapshot_totals_logfile { %totals=(); $in_totals=0; $maxlen=0; + $found_startdate=0; $header=""; while() { $line = $_; if($line =~ /logfile turned over/) { next; } + if(($in_totals == 0) && ("$startdate" ne "") && ($line !~ /$startdate/) && ($found_startdate==0)) { next; } + if(($in_totals == 0) && ("$startdate" ne "") && ($line =~ /$startdate/) && ($found_startdate==0)) { $found_startdate=1; } 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; @@ -107,9 +110,9 @@ sub parse_snapshot_totals_logfile { elsif(($in_totals == 1) && ($line =~ /^\s+$/)) { $in_totals = 0; } - elsif(($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 =~ /Snapshots/ || $filesystem =~ /Total/) { next; } if($filesystem =~ /$backup_pool/) { next; } if(length($filesystem) > $maxlen) { $maxlen = length($filesystem); } if($size =~ /K/i) { $data = $data * $kilo; } @@ -129,6 +132,7 @@ sub parse_snapshot_totals_logfile { foreach $date (sort keys %$hashref) { if($date !~ /(\d+)-(\d+)-(\d+)/) { next; } $date_data=adjust_data($totals{$filesystem}{$date}{data}); + if($date_data eq "") { $date_data = "0"; } $data .= sprintf("%10s",$date_data). " "; $date_totals{$date}{data} += $totals{$filesystem}{$date}{data}; }