1 diff -urN amavis-stats-0.1.22.orig/configure.in amavis-stats-0.1.22/configure.in
2 --- amavis-stats-0.1.22.orig/configure.in 2006-12-04 13:59:29.000000000 +0100
3 +++ amavis-stats-0.1.22/configure.in 2008-05-12 14:38:27.000000000 +0200
5 AC_PATH_PROG(CP, cp, cp)
6 AC_PATH_PROG(CHMOD, chmod, chmod)
7 AC_PATH_PROG(CHOWN, chown, chown)
8 -AC_PATH_PROGS(GZCAT, gzcat, no)
9 AC_PATH_PROGS(NROFF, gnroff nroff)
10 AC_PATH_PROGS(TROFF, groff troff)
14 PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
16 -if test "$GZCAT" = no; then
24 if test "$PATCH" = no; then
27 diff -urN amavis-stats-0.1.22.orig/doc/Makefile.in amavis-stats-0.1.22/doc/Makefile.in
28 --- amavis-stats-0.1.22.orig/doc/Makefile.in 2006-12-04 14:00:42.000000000 +0100
29 +++ amavis-stats-0.1.22/doc/Makefile.in 2008-05-12 14:38:27.000000000 +0200
35 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
38 diff -urN amavis-stats-0.1.22.orig/etc/Makefile.in amavis-stats-0.1.22/etc/Makefile.in
39 --- amavis-stats-0.1.22.orig/etc/Makefile.in 2006-12-04 14:00:44.000000000 +0100
40 +++ amavis-stats-0.1.22/etc/Makefile.in 2008-05-12 14:38:27.000000000 +0200
46 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
49 diff -urN amavis-stats-0.1.22.orig/Makefile.in amavis-stats-0.1.22/Makefile.in
50 --- amavis-stats-0.1.22.orig/Makefile.in 2006-12-04 13:59:40.000000000 +0100
51 +++ amavis-stats-0.1.22/Makefile.in 2008-05-12 14:38:27.000000000 +0200
57 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
60 diff -urN amavis-stats-0.1.22.orig/php/Makefile.in amavis-stats-0.1.22/php/Makefile.in
61 --- amavis-stats-0.1.22.orig/php/Makefile.in 2006-12-04 14:00:39.000000000 +0100
62 +++ amavis-stats-0.1.22/php/Makefile.in 2008-05-12 14:38:27.000000000 +0200
68 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
71 diff -urN amavis-stats-0.1.22.orig/sbin/amavis-stats.in amavis-stats-0.1.22/sbin/amavis-stats.in
72 --- amavis-stats-0.1.22.orig/sbin/amavis-stats.in 2006-01-21 02:25:01.000000000 +0100
73 +++ amavis-stats-0.1.22/sbin/amavis-stats.in 2008-05-12 14:38:57.000000000 +0200
75 Exporter POSIX Fcntl Errno Carp Time::HiRes
76 Unix::Syslog RRDp RRDs IO::File
77 warnings Time::localtime Time::Local
83 use Unix::Syslog qw(:macros :subs);
89 import AmavisStats::Conf qw(:platform $myversion $myhostname $daemon_user);
90 @@ -1596,6 +1598,55 @@
96 + my ($fname, $start) = @_;
97 + do_log(2, "parseFilegz($fname, $start)");
100 + # Open up the file we need to parse
102 + unless (my $gz = gzopen ($fname, "rb") {
103 + do_log(1, "ERROR : Could not open file $fname: $!");
107 + # Loop each line until the current end of file
110 + while ($pos < $start) {
111 + $pos += $gz->gzreadline($line);
118 + $p = $gz->gzreadline($line);
123 + $lastepoch = $epoch;
125 + if ($line =~ /amavis.*?\[\d+\]:/) {
130 + # Save the current statistics every 1000 lines. This way
131 + # if the program dies we don't have to start again from the
132 + # beginning each time. Also good for monitoring the graphs
133 + # to see where we are up to.
135 + if (!($lineid % 1000)) {
144 do_log(5, "DEBUG : parseRotFile()");
145 my ($scan_logfile, $spos) = @_;
146 @@ -1614,25 +1665,65 @@
148 my $rotlogfile = undef;
150 - if (! -f "$scan_logfile.0" && -f "$scan_logfile.0.gz" ) {
151 - do_log(2 , "copying $scan_logfile.0.gz -> $scan_logfile.0");
152 - `gzcat "$scan_logfile.0.gz" > "$scan_logfile.0"`;
155 if (-f "$scan_logfile.0") {
156 $rotlogfile = $scan_logfile . ".0";
157 + } elsif (-f "$scan_logfile.0.gz") {
158 + $rotlogfile = $scan_logfile . ".0.gz";
159 } elsif (-f "$scan_logfile.1") {
160 $rotlogfile = $scan_logfile . ".1";
161 + } elsif (-f "$scan_logfile.1.gz") {
162 + $rotlogfile = $scan_logfile . ".1.gz";
163 } elsif (-f "$scan_logfile.01") {
164 $rotlogfile = $scan_logfile . ".01";
165 + } elsif (-f "$scan_logfile.01.gz") {
166 + $rotlogfile = $scan_logfile . ".01.gz";
167 } elsif (-f "$scan_logfile-$today") {
168 $rotlogfile = $scan_logfile . "-$today";
169 + } elsif (-f "$scan_logfile-$today.gz") {
170 + $rotlogfile = $scan_logfile . "-$today.gz";
171 } elsif (-f "$scan_logfile-$yesterday") {
172 $rotlogfile = $scan_logfile . "-$yesterday";
173 + } elsif (-f "$scan_logfile-$yesterday.gz") {
174 + $rotlogfile = $scan_logfile . "-$yesterday.gz";
176 + $rotlogfile = $logfile;
177 + # $rotlogfile =~ s/(.*)\/([a-z]*)/$1\/archiv\/$2/g;
178 + $rotlogfile =~ s/\/var\/log\/(.*)/\/var\/log\/archive\/$1/g;
179 + if ($rotlogfile eq $logfile) {
180 + $rotlogfile = "archiv/$logfile";
182 + if (-f "$rotlogfile.0") {
183 + $rotlogfile = $rotlogfile . ".0";
184 + } elsif (-f "$rotlogfile.0.gz") {
185 + $rotlogfile = $rotlogfile . ".0.gz";
186 + } elsif (-f "$rotlogfile.1") {
187 + $rotlogfile = $rotlogfile . ".1";
188 + } elsif (-f "$rotlogfile.1.gz") {
189 + $rotlogfile = $rotlogfile . ".1.gz";
190 + } elsif (-f "$rotlogfile.01") {
191 + $rotlogfile = $rotlogfile . ".01";
192 + } elsif (-f "$rotlogfile.01.gz") {
193 + $rotlogfile = $rotlogfile . ".01.gz";
194 + } elsif (-f "$rotlogfile-$today") {
195 + $rotlogfile = $rotlogfile . "-$today";
196 + } elsif (-f "$rotlogfile-$today.gz") {
197 + $rotlogfile = $rotlogfile . "-$today.gz";
198 + } elsif (-f "$rotlogfile-$yesterday") {
199 + $rotlogfile = $rotlogfile . "-$yesterday";
200 + } elsif (-f "$rotlogfile-$yesterday.gz") {
201 + $rotlogfile = $rotlogfile . "-$yesterday.gz";
203 + if (! -f $rotlogfile) {
204 + $rotlogfile = undef;
208 if (defined $rotlogfile) {
209 - parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
210 + if ($rotlogfile =~ /\.gz$/) {
211 + parseFilegz ($rotlogfile, $spos);
213 + parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
216 do_log(1, "ERROR : Could not open rotated logfile.");
217 do_log(1, "ERROR : Tried extentions .0.gz, .0, .1, .01, -$today, -$yesterday");
218 @@ -1803,7 +1894,11 @@
221 do_log(5, "DEBUG : $scan_logfile, $spos, $eof");
222 - parseFile ($scan_logfile, $spos, $eof);
223 + if ($scan_logfile =~ /\.gz$/) {
224 + parseFilegz ($scan_logfile, $spos);
226 + parseFile ($scan_logfile, $spos, $eof);
230 do_log(1, sprintf("Finished -> %s", $scan_domains eq '.*' ? 'localhost' : $scan_domains));
231 diff -urN amavis-stats-0.1.22.orig/sbin/Makefile.in amavis-stats-0.1.22/sbin/Makefile.in
232 --- amavis-stats-0.1.22.orig/sbin/Makefile.in 2006-12-04 14:00:49.000000000 +0100
233 +++ amavis-stats-0.1.22/sbin/Makefile.in 2008-05-12 14:38:27.000000000 +0200
236 GCJFLAGS = @GCJFLAGS@
239 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
241 LINK_CMD = @LINK_CMD@
242 diff -urN amavis-stats-0.1.22.orig/share/Makefile.in amavis-stats-0.1.22/share/Makefile.in
243 --- amavis-stats-0.1.22.orig/share/Makefile.in 2006-12-04 14:00:47.000000000 +0100
244 +++ amavis-stats-0.1.22/share/Makefile.in 2008-05-12 14:38:27.000000000 +0200
247 GCJFLAGS = @GCJFLAGS@
250 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
252 LINK_CMD = @LINK_CMD@
253 diff -urN amavis-stats-0.1.22.orig/startup/Makefile.in amavis-stats-0.1.22/startup/Makefile.in
254 --- amavis-stats-0.1.22.orig/startup/Makefile.in 2006-12-04 14:02:26.000000000 +0100
255 +++ amavis-stats-0.1.22/startup/Makefile.in 2008-05-12 14:38:27.000000000 +0200
258 GCJFLAGS = @GCJFLAGS@
261 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
263 LINK_CMD = @LINK_CMD@