From: Alan J. Pippin <ajp@pippins.net>
Date: Fri, 22 Aug 2008 03:23:53 +0000 (-0600)
Subject: Added support for handling compressed files
X-Git-Url: http://git.pippins.net/checkmark.gif?a=commitdiff_plain;h=99d9aa527fad3b987aaf37d43f113fc0d1cfb0fd;p=zfs-nexenta%2F.git

Added support for handling compressed files
---

diff --git a/zfs-log-parser b/zfs-log-parser
index 2167493..4ecca3c 100755
--- a/zfs-log-parser
+++ b/zfs-log-parser
@@ -159,7 +159,11 @@ sub parse_snapshot_totals_logfile {
 # MAIN
 #########
 #print "-> Parsing $logfile\n";
-open(FILE,"$logfile") || die "-E- Unable to open $logfile\n";
+if("$logfile" =~ /\.[bz2|gz]/) { 
+  open(FILE,"zcat $logfile|") || die "-E- Unable to open $logfile\n";
+} else {
+  open(FILE,"$logfile") || die "-E- Unable to open $logfile\n";
+}
 
 if($logfile =~ /replicate/) { parse_replicate_logfile(); }
 if($logfile =~ /snapshot-totals/) { parse_snapshot_totals_logfile(); }