]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
logresolvemerge.pl can read .xz files.
authorChristian Pietsch <christian.pietsch@uni-bielefeld.de>
Wed, 3 Jun 2015 12:20:32 +0000 (14:20 +0200)
committerChristian Pietsch <christian.pietsch@uni-bielefeld.de>
Wed, 3 Jun 2015 12:20:32 +0000 (14:20 +0200)
tools/logresolvemerge.pl [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 61fb7f3..0251a56
@@ -94,9 +94,11 @@ use vars qw/
 my $zcat = 'gzip -cd';
 my $zcat_file = '\.gz$';
 # For bz2 compression
-my $bzcat = 'bzcat';
+my $bzcat = 'bzip2 -cd';
 my $bzcat_file = '\.bz2$';
-
+# For xz compression
+my $xzcat = 'xz -cd';
+my $xzcat_file = '\.xz$';
 
 
 #-----------------------------------------------------------------------------
@@ -327,7 +329,7 @@ if (scalar @ParamFile == 0) {
        print "$PROG allows you to get one unique output log file, sorted on date,\n";
        print "built from particular sources:\n";
        print " - It can read several input log files,\n";
-       print " - It can read .gz/.bz2 log files,\n";
+       print " - It can read .gz/.bz2/.xz log files,\n";
        print " - It can also makes a fast reverse DNS lookup to replace\n";
        print "   all IP addresses into host names in resulting log file.\n";
        print "$PROG comes with ABSOLUTELY NO WARRANTY. It's a free software\n";
@@ -391,7 +393,7 @@ if (scalar @ParamFile == 0) {
        print "\n";
        print "Now supports/detects:\n";
        print "  Automatic detection of log format\n";
-       print "  Files can be .gz/.bz2 files if zcat/bzcat tools are available in PATH.\n";
+       print "  Files can be .gz/.bz2/.xz files if gzip/bzip2/xz tools are available in PATH.\n";
        print "  Multithreaded reverse DNS lookup (several parallel requests) with Perl 5.8+.\n";
        print "New versions and FAQ at http://www.awstats.org\n";
        exit 0;
@@ -468,6 +470,11 @@ foreach my $key (0..(@ParamFile-1)) {
                        # Modify the name to include the bzcat command
                        $ParamFile[$key] = $bzcat . ' ' . $ParamFile[$key] . ' |';
                }
+               elsif ($ParamFile[$key] =~ /$xzcat_file/) {
+                       if ($Debug) { debug("XZ compression detected for Log file $ParamFile[$key]."); }
+                       # Modify the name to include the xzcat command
+                       $ParamFile[$key] = $xzcat . ' ' . $ParamFile[$key] . ' |';
+               }
 
                $LogFileToDo{$cpt}=@ParamFile[$key];
                $cpt++;
@@ -499,6 +506,11 @@ foreach my $key (0..(@ParamFile-1)) {
                     # Modify the name to include the bzcat command
                     $LogFileToDo{$cpt}=$bzcat . ' ' . "$DirFile/$filearray[$i]" . ' |';
                 }
+                elsif ($filearray[$i] =~ /$xzcat_file/) {
+                    if ($Debug) { debug("XZ compression detected for Log file $filearray[$i]."); }
+                    # Modify the name to include the xzcat command
+                    $LogFileToDo{$cpt}=$xzcat . ' ' . "$DirFile/$filearray[$i]" . ' |';
+                }
                 else {
                     $LogFileToDo{$cpt}="$DirFile/$filearray[$i]";
                 }