Added support for handling compressed files
authorAlan J. Pippin <ajp@pippins.net>
Fri, 22 Aug 2008 03:23:53 +0000 (21:23 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Fri, 22 Aug 2008 03:23:53 +0000 (21:23 -0600)
zfs-log-parser

index 2167493f9676a2d91fd538b6a569a28605acec40..4ecca3c37e59db5a4aaeecfa9dea6277b4dda928 100755 (executable)
@@ -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(); }