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 18:28:44.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 18:28:44.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 18:28:44.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 18:28:44.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 18:28:44.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 18:36:55.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,56 @@
96 + my ($fname, $start) = @_;
97 + do_log(2, "parseFilegz($fname, $start)");
100 + # Open up the file we need to parse
103 + unless ($gz = gzopen ($fname, "rb")) {
104 + do_log(1, "ERROR : Could not open file $fname: $!");
108 + # Loop each line until the current end of file
111 + while ($pos < $start) {
112 + $pos += $gz->gzreadline($line);
119 + $p = $gz->gzreadline($line);
124 + $lastepoch = $epoch;
126 + if ($line =~ /amavis.*?\[\d+\]:/) {
131 + # Save the current statistics every 1000 lines. This way
132 + # if the program dies we don't have to start again from the
133 + # beginning each time. Also good for monitoring the graphs
134 + # to see where we are up to.
136 + if (!($lineid % 1000)) {
145 do_log(5, "DEBUG : parseRotFile()");
146 my ($scan_logfile, $spos) = @_;
147 @@ -1614,25 +1666,65 @@
149 my $rotlogfile = undef;
151 - if (! -f "$scan_logfile.0" && -f "$scan_logfile.0.gz" ) {
152 - do_log(2 , "copying $scan_logfile.0.gz -> $scan_logfile.0");
153 - `gzcat "$scan_logfile.0.gz" > "$scan_logfile.0"`;
156 if (-f "$scan_logfile.0") {
157 $rotlogfile = $scan_logfile . ".0";
158 + } elsif (-f "$scan_logfile.0.gz") {
159 + $rotlogfile = $scan_logfile . ".0.gz";
160 } elsif (-f "$scan_logfile.1") {
161 $rotlogfile = $scan_logfile . ".1";
162 + } elsif (-f "$scan_logfile.1.gz") {
163 + $rotlogfile = $scan_logfile . ".1.gz";
164 } elsif (-f "$scan_logfile.01") {
165 $rotlogfile = $scan_logfile . ".01";
166 + } elsif (-f "$scan_logfile.01.gz") {
167 + $rotlogfile = $scan_logfile . ".01.gz";
168 } elsif (-f "$scan_logfile-$today") {
169 $rotlogfile = $scan_logfile . "-$today";
170 + } elsif (-f "$scan_logfile-$today.gz") {
171 + $rotlogfile = $scan_logfile . "-$today.gz";
172 } elsif (-f "$scan_logfile-$yesterday") {
173 $rotlogfile = $scan_logfile . "-$yesterday";
174 + } elsif (-f "$scan_logfile-$yesterday.gz") {
175 + $rotlogfile = $scan_logfile . "-$yesterday.gz";
177 + $rotlogfile = $scan_logfile;
178 + # $rotlogfile =~ s/(.*)\/([a-z]*)/$1\/archiv\/$2/g;
179 + $rotlogfile =~ s/\/var\/log\/(.*)/\/var\/log\/archive\/$1/g;
180 + if ($rotlogfile eq $scan_logfile) {
181 + $rotlogfile = "archiv/$scan_logfile";
183 + if (-f "$rotlogfile.0") {
184 + $rotlogfile = $rotlogfile . ".0";
185 + } elsif (-f "$rotlogfile.0.gz") {
186 + $rotlogfile = $rotlogfile . ".0.gz";
187 + } elsif (-f "$rotlogfile.1") {
188 + $rotlogfile = $rotlogfile . ".1";
189 + } elsif (-f "$rotlogfile.1.gz") {
190 + $rotlogfile = $rotlogfile . ".1.gz";
191 + } elsif (-f "$rotlogfile.01") {
192 + $rotlogfile = $rotlogfile . ".01";
193 + } elsif (-f "$rotlogfile.01.gz") {
194 + $rotlogfile = $rotlogfile . ".01.gz";
195 + } elsif (-f "$rotlogfile-$today") {
196 + $rotlogfile = $rotlogfile . "-$today";
197 + } elsif (-f "$rotlogfile-$today.gz") {
198 + $rotlogfile = $rotlogfile . "-$today.gz";
199 + } elsif (-f "$rotlogfile-$yesterday") {
200 + $rotlogfile = $rotlogfile . "-$yesterday";
201 + } elsif (-f "$rotlogfile-$yesterday.gz") {
202 + $rotlogfile = $rotlogfile . "-$yesterday.gz";
204 + if (! -f $rotlogfile) {
205 + $rotlogfile = undef;
209 if (defined $rotlogfile) {
210 - parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
211 + if ($rotlogfile =~ /\.gz$/) {
212 + parseFilegz ($rotlogfile, $spos);
214 + parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
217 do_log(1, "ERROR : Could not open rotated logfile.");
218 do_log(1, "ERROR : Tried extentions .0.gz, .0, .1, .01, -$today, -$yesterday");
219 @@ -1803,7 +1895,11 @@
222 do_log(5, "DEBUG : $scan_logfile, $spos, $eof");
223 - parseFile ($scan_logfile, $spos, $eof);
224 + if ($scan_logfile =~ /\.gz$/) {
225 + parseFilegz ($scan_logfile, $spos);
227 + parseFile ($scan_logfile, $spos, $eof);
231 do_log(1, sprintf("Finished -> %s", $scan_domains eq '.*' ? 'localhost' : $scan_domains));
232 diff -urN amavis-stats-0.1.22.orig/sbin/Makefile.in amavis-stats-0.1.22/sbin/Makefile.in
233 --- amavis-stats-0.1.22.orig/sbin/Makefile.in 2006-12-04 14:00:49.000000000 +0100
234 +++ amavis-stats-0.1.22/sbin/Makefile.in 2008-05-12 18:28:44.000000000 +0200
237 GCJFLAGS = @GCJFLAGS@
240 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
242 LINK_CMD = @LINK_CMD@
243 diff -urN amavis-stats-0.1.22.orig/share/Makefile.in amavis-stats-0.1.22/share/Makefile.in
244 --- amavis-stats-0.1.22.orig/share/Makefile.in 2006-12-04 14:00:47.000000000 +0100
245 +++ amavis-stats-0.1.22/share/Makefile.in 2008-05-12 18:28:44.000000000 +0200
248 GCJFLAGS = @GCJFLAGS@
251 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
253 LINK_CMD = @LINK_CMD@
254 diff -urN amavis-stats-0.1.22.orig/startup/Makefile.in amavis-stats-0.1.22/startup/Makefile.in
255 --- amavis-stats-0.1.22.orig/startup/Makefile.in 2006-12-04 14:02:26.000000000 +0100
256 +++ amavis-stats-0.1.22/startup/Makefile.in 2008-05-12 18:28:44.000000000 +0200
259 GCJFLAGS = @GCJFLAGS@
262 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
264 LINK_CMD = @LINK_CMD@