debian/0000755000000000000000000000000011724256175007200 5ustar debian/wwwerrs.80000644000000000000000000000273511720167430011007 0ustar .\" Copyright (c) 2004 Tim Peeler .\" All rights reserved. The file LICENSE (the Artistic License) .\" specifies the terms and conditions for redistribution. .\" .if n .tr \-- .if n .tr \(buo .if n .tr \(em- .TH wwwerrs 8 "18 November 2004" .if n .ad l .SH NAME wwwerrs \- httpd log rotation for wwwstat .SH SYNOPSIS .HP 8 .B wwwerrs .B [error log name] .SH DESCRIPTION .nh This program reads the httpd error_log logfile (or whatever file is given as the single argument) looking for failed requests (bad URLs) which include a valid Referer (and thus can be tracked to the origin of the reference). It assumes that the error_log has been enhanced to include the referer information (as in NCSA 1.4 and later). .LP The output is an HTML file that makes it easy to check references. The script should be edited to discard normal error messages, where normal is dependent on your particular server. .LP .SH SEE ALSO .BR crontab (1), .BR httpd (1m), .BR perl (1), .BR wwwstat (1), .BR splitlog (1), .BR monthly (8), .BR oldlog2new (8) .LP More info and the latest version of wwwerrs can be obtained from .LP http://www.ics.uci.edu/pub/websoft/wwwstat/ ftp://www.ics.uci.edu/pub/websoft/wwwstat/ .LP If you have any suggestions, bug reports, fixes, or enhancements, please join the mailing list by sending e-mail with "subscribe" in the subject of the message to the request address . The list is archived at the above address. debian/oldlog2new.80000644000000000000000000000275511720167430011345 0ustar .\" Copyright (c) 2004 Tim Peeler .\" All rights reserved. The file LICENSE (the Artistic License) .\" specifies the terms and conditions for redistribution. .\" .if n .tr \-- .if n .tr \(buo .if n .tr \(em- .TH oldlog2new 8 "18 November 2004" .if n .ad l .SH NAME oldlog2new \- Convert an NCSA httpd 1.1 access_log file to CLF access_log .SH SYNOPSIS .HP 8 .B oldlog2new [ .B -hez ] [ .B -f logfile ] [ .B -s srmfile ] .SH DESCRIPTION .nh Convert an NCSA httpd 1.1 access_log file to CLF access_log .SH OPTIONS .nh .B Display Options: \-h Help -- just display this message and quit. \-e Display all invalid log entries on STDERR. (default is to ignore them) .LP .nh .B Input Options: \-f Read from the following access_log file instead of the default. \-z Use zcat to uncompress the log file while reading [requires \-f]. \-s Get the server directives from the following srm.conf file. .LP .SH SEE ALSO .BR crontab (1), .BR httpd (1m), .BR perl (1), .BR wwwstat (1), .BR splitlog (1), .BR monthly (8), .BR oldlog2new (8) .LP More info and the latest version of oldlog2new can be obtained from .LP http://www.ics.uci.edu/pub/websoft/wwwstat/ ftp://www.ics.uci.edu/pub/websoft/wwwstat/ .LP If you have any suggestions, bug reports, fixes, or enhancements, please join the mailing list by sending e-mail with "subscribe" in the subject of the message to the request address . The list is archived at the above address. debian/wwwerrs.rc0000644000000000000000000000040611720167434011241 0ustar $ErrorLog = '/var/log/apache/error.log'; # Server's Error Log $UnusualHeader = "Unusual Error Messages"; $ConfigHeader = "Client Denied by Server Configuration"; $PermHeader = "File Permissions Deny Access"; $ExistHeader = "File Does Not Exist"; 1; debian/rules0000755000000000000000000000014511720167434010253 0ustar #!/usr/bin/make -f # debhelper rules file for wwwstat, the httpd logfile analysis package %: dh $@ debian/watch0000644000000000000000000000012011720167430010211 0ustar version=3 http://ftp.ics.uci.edu/pub/websoft/wwwstat/ wwwstat-([\d.]+)\.tar\.gz debian/source/0000755000000000000000000000000011724255632010475 5ustar debian/source/format0000644000000000000000000000001411720167434011701 0ustar 3.0 (quilt) debian/changelog0000644000000000000000000001026011724256113011041 0ustar wwwstat (2.0-7) unstable; urgency=low * Update the copyright file: - add a dot to fix the formatting - update to the latest DEP 5 candidate format - change "Artistic (old)" to "Artistic-1.0" - bump the year on my copyright notice * Convert the packaging to Git and change the Vcs-* URLs to Gitorious. * Add the 09-getopt patch to use Getopt::Std instead of the Perl 4 getopt library. Closes: #659433 * Bump Standards-Version to 3.9.3 with no changes. * Bump the debhelper compatibility level to 9 with no changes. * Add Multi-Arch: foreign to the binary package just in case. * Drop the version from the dependency on perl. -- Peter Pentchev Sat, 03 Mar 2012 01:48:24 +0200 wwwstat (2.0-6) unstable; urgency=low * Convert to the 3.0 (quilt) source format: - drop the quilt build dependency - adjust the debhelper dependency's version to plain 7 now that there is no use for override rules at all - remove the README.source file * Use perl:Depends instead of plain "perl" in the control file. * Bump Standards-Version to 3.9.1 with no changes. * Do not install the Changes file - it's installed as changelog.gz already * Add a doc-base control file. * Update the copyright file to the latest revision of the DEP 5 proposed format and bump the year on my copyright notice. * Shorten the Vcs-Browser URL. * Add DEP 3 patch headers. * Rework the patches a bit: - rename the 01-Makefile patch to 01-debian - bring the 06-default-log patch into the Debian-specific 01-debian patch - break out the *.rc config files into separate real files in the debian/ subdirectory and install them using dh_install, not the Makefile - combine the three *.rc support patches into the 03-config-files patch - use dh_install to install the binaries and libraries, too - split the 02-wwwstat patch into 02-eof-defined and 07-optimize - break out the percentage calculations into a separate function, too - mark the 02-eof-defined, 03-config-files, and 07-optimize patches as forwarded upstream * Add the upstream daily/nodaily parsing patch as 08-wwwstat-2.01. -- Peter Pentchev Fri, 06 Aug 2010 17:58:49 +0300 wwwstat (2.0-5) unstable; urgency=low * New maintainer. Closes: #519383 * Use quilt for patch management. * Add a watchfile. * Move debhelper from B-D-I to B-D - used in the "clean" target. * Move the manual pages to separate files under debian/ instead of creating them from a patch. * Correct the copyright statements on the manual pages. * Use wwwstat.manpages and do not pass -A to dh_installman. * Fix a couple of hyphens in the oldlog2new.8 manual page. * Add the Homepage, Vcs-Svn, and Vcs-Browser fields. * Bump the debhelper compatibility version to 7: - add misc:Depends to the binary package - minimize the rules file using debhelper's override targets * Bump Standards-Version to 3.8.1: - add the README.source file mentioning the use of quilt * Update the copyright file: - convert it to the machine-parseable format - add my copyright notice on the Debian packaging - elaborate on the need to quote the package's LICENSE file verbatim; wwwstat is licensed under the old Artistic license, not the one included in common-licenses, so it must be spelled out in full - remove the note about common-licenses * Do not install the README file - it contains no useful info by itself. -- Peter Pentchev Mon, 06 Apr 2009 01:17:11 +0300 wwwstat (2.0-4) unstable; urgency=low * fixed some errors with testing $foo = constructs -- Tim Peeler Fri, 23 Dec 2005 08:46:16 -0500 wwwstat (2.0-3) unstable; urgency=low * Added option to skip sorting on low memory systems -- Tim Peeler Tue, 21 Jun 2005 17:02:31 -0400 wwwstat (2.0-2) unstable; urgency=low * Fixups to the build process * Added undocumented manpages * Misc cleanups -- Tim Peeler Tue, 16 Nov 2004 10:48:00 -0500 wwwstat (2.0-1) unstable; urgency=low * Initial Release. * closes: #280327 -- Tim Peeler Wed, 5 May 2004 06:27:07 -0500 debian/oldlog2new.rc0000644000000000000000000000232511720167434011577 0ustar # --------------------------------------------------------------------------- # Set the default configuration options: # Edit the next line to specify the (+/-)HHMM offset from GMT $GMToffset = '-0700'; # Edit the next line to identify the server's default home page. $ServerHome = "/"; # Edit the next two lines to specify the location of your server access log # and your server configuration (srm.conf) file. $access_log = '/var/log/apache/access.log'; $srm_conf = '/etc/apache/srm.conf'; # Edit the next line to specify the command for displaying compressed files $zcat = 'gunzip -c'; # specify as null string if none are available # Estimate the size of a redirect message minus the two location URLs $DirectoryRedirect = 1; # Does server do automatic redirect for slashless # index reqs? (1 for httpd_1.1, 0 for httpd_1.0) # Is the server running with rfc931 support (IdentityCheck on)? $IdentityCheck = 0; # Must = 1 if server uses rfc931 remote ident. # Edit the next few lines to specify whether (1) or not (0) you want: $PrintInvalids = 0; # Display invalid log entries on STDERR? $CompressedLog = 0; # Access log has been compressed (or gzipped)? 1; debian/wwwstat.manpages0000644000000000000000000000011311720167430012417 0ustar wwwstat.1 splitlog.1 debian/oldlog2new.8 debian/wwwerrs.8 debian/monthly.8 debian/control0000644000000000000000000000160411724255747010610 0ustar Source: wwwstat Section: admin Priority: optional Maintainer: Peter Pentchev DM-Upload-Allowed: yes Build-Depends: debhelper (>= 9) Build-Depends-Indep: perl Standards-Version: 3.9.3 Homepage: http://ftp.ics.uci.edu/pub/websoft/wwwstat/ Vcs-Git: git://gitorious.org/wwwstat/wwwstat-pkg.git Vcs-Browser: http://gitorious.org/wwwstat/wwwstat-pkg Package: wwwstat Architecture: all Depends: ${perl:Depends}, ${misc:Depends} Multi-Arch: foreign Description: httpd logfile analysis package wwwstat processes a sequence of httpd Common Logfile Format access_log files and prior summary outputs, and then outputs a summary of the access statistics in a nice HTML format. . splitlog processes a sequence of httpd Common Logfile Format access_log files (or CLF with a one-field prefix) and splits the entries into separate files according to the requested URL and/or vhost prefix. debian/copyright0000644000000000000000000001762711724177022011141 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: wwwstat Upstream-Contact: Roy Fielding Source: http://ftp.ics.uci.edu/pub/websoft/wwwstat/ Files: * Copyright: Copyright (c) 1994, 1996 Regents of the University of California. License: Artistic-1.0 This is a verbatim copy of the package's LICENSE file: . Licensing and Distribution Information: . This software has been developed by Roy Fielding as part of the WebSoft project at the University of California, Irvine. wwwstat was originally based on a multi-server statistics program called fwgstat-0.035 by Jonathan Magid (jem@sunsite.unc.edu) which, in turn, was heavily based on xferstats (packaged with the version 17 of the wuarchive FTP daemon) by Chris Myers (chris@wugate.wustl.edu). Those parts of wwwstat derived from fwgstat and xferstats are in the public domain. . The latest version of wwwstat can be obtained from . http://www.ics.uci.edu/pub/websoft/wwwstat/ ftp://www.ics.uci.edu/pub/websoft/wwwstat/ . The wwwstat package and those portions developed exclusively at the University of California are covered by the above copyright notice. Redistribution and use in source and binary forms are permitted, subject to the restrictions noted below, provided that the above copyright notice and this paragraph and the following paragraphs are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed in part by the University of California, Irvine. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. . IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . Redistribution: . The "Artistic License" . Preamble . The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. . Definitions: . "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. . "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. . "Copyright Holder" is whoever is named in the copyright or copyrights for the package. . "You" is you, if you're thinking about copying or distributing this Package. . "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) . "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. . 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. . 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. . 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: . a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. . b) use the modified Package only within your corporation or organization. . c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. . d) make other distribution arrangements with the Copyright Holder. . 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: . a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. . b) accompany the distribution with the machine-readable source of the Package with your modifications. . c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. . d) make other distribution arrangements with the Copyright Holder. . 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. . 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. . 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. . 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. . 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. . The End Files: debian/* Copyright: Copyright (c) 2004, 2005 Tim Peeler Copyright (c) 2009, 2010, 2012 Peter Pentchev License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License; either version 2 of the License, or (at your option) any later version. . On Debian systems the full text of the GNU General Public License can be found in the `/usr/share/common-licenses/GPL-2' file. Files: debian/*.8 Copyright: Copyright (c) 2004 Tim Peeler License: Artistic-1.0 See the "Files: *" clause above for the full license information. debian/monthly.rc0000644000000000000000000000074011720167434011214 0ustar $zcommand = 'gzip -9'; $zextension = '.gz'; $wstatcmd = 'wwwstat'; # Set up the filenames to be used $ServerRoot = '/var/www'; $NewLog = '/var/log/apache/access.log'; # Current logfile $OldLog = $NewLog . '.1'; # and temp location $PidFile = '/var/run/apache.pid';; # Server's PID file $ErrorLog = '/var/log/apache/error.log'; # Server's Error Log $TempLog = "/tmp/templog-$$.txt"; # Temporary file for last month's log 1; debian/patches/0000755000000000000000000000000011724255722010624 5ustar debian/patches/series0000644000000000000000000000016411724166234012041 0ustar 01-debian.patch 02-eof-defined.patch 03-config-files.patch 07-optimize.patch 08-wwwstat-2.01.patch 09-getopts.patch debian/patches/08-wwwstat-2.01.patch0000644000000000000000000000364611720167434014177 0ustar Description: An upstream patch to fix the daily/nodaily parsing Origin: vendor, http://ftp.ics.uci.edu/pub/websoft/wwwstat/patch-2.01.txt Author: Jesus Calle Vaquero Last-Update: 2010-08-06 --- a/Changes +++ b/Changes @@ -19,6 +19,9 @@ and . +Version 2.01 patch 12 November 1996 + Fixed bug in parsing -daily and -nodaily. + Version 2.0 04 November 1996 Added splitlog script for splitting logfile by virtual host or URL path. Added manual for splitlog in all three formats. --- a/wwwstat.pl +++ b/wwwstat.pl @@ -1,6 +1,6 @@ #!YOUR_PERL_BINARY # ========================================================================== -$Version = 'wwwstat-2.0'; +$Version = 'wwwstat-2.01'; # # Copyright (c) 1994, 1996 Regents of the University of California. # @@ -391,7 +391,7 @@ elsif (/^files$/) { $TruncateFile = 1; } elsif (/^dns$/) { $LookupDNS = 0; } elsif (/^cgi$/) { $Do_CGI = 0; } - elsif (/^da(y|aily|ate)$/) { $Do_Daily = 0; } + elsif (/^da(y|ily|te)$/) { $Do_Daily = 0; } elsif (/^hour(ly)?$/) { $Do_Hourly = 0; } elsif (/^dom(ain)?$/) { $Do_Domain = 0; } elsif (/^sub(domain)?$/) { $Do_Subdomain = 0; } @@ -411,7 +411,7 @@ $Do_Daily = $Do_Hourly = $Do_Domain = $Do_Subdomain = $Do_Archive = $Do_Ident = 1; } - elsif (/^da(y|aily|ate)$/) { $scope = 1; $Do_Daily = 1; } + elsif (/^da(y|ily|te)$/) { $scope = 1; $Do_Daily = 1; } elsif (/^hour(ly)?$/) { $scope = 2; $Do_Hourly = 1; } elsif (/^dom(ain)?$/) { $scope = 3; $Do_Domain = 1; } elsif (/^sub(domain)?$/) { $scope = 4; $Do_Subdomain = 1; } debian/patches/03-config-files.patch0000644000000000000000000000206011720167434014426 0ustar Description: Use *.rc files in monthly(8), oldlogs2new(8), and wwwerrs(8). Forwarded: yes Author: Tim Peeler Last-Update: 2010-08-06 --- a/monthly.pl +++ b/monthly.pl @@ -52,6 +52,8 @@ $TempLog = "/tmp/templog-$$.txt"; # Temporary file for last month's log +require "/etc/wwwstat/monthly.rc"; + print "Got the defaults\n"; # ========================================================================== --- a/oldlog2new.pl +++ b/oldlog2new.pl @@ -70,6 +70,8 @@ $PrintInvalids = 0; # Display invalid log entries on STDERR? $CompressedLog = 0; # Access log has been compressed (or gzipped)? +require "/etc/wwwstat/oldlog2new.rc"; + # ========================================================================== # Get the command-line options --- a/wwwerrs.pl +++ b/wwwerrs.pl @@ -57,6 +57,8 @@ $PermHeader = "File Permissions Deny Access"; $ExistHeader = "File Does Not Exist"; +require "/etc/wwwstat/wwwerrs.rc"; + # ========================================================================== # Start output debian/patches/09-getopts.patch0000644000000000000000000000107011724174473013561 0ustar Description: Use Getopt::Std instead of the Perl 4 getopt library. Forwarded: no Bug-Debian: http://bugs.debian.org/659433 Author: Peter Pentchev Last-Update: 2012-03-02 --- a/oldlog2new.pl +++ b/oldlog2new.pl @@ -75,8 +75,10 @@ # ========================================================================== # Get the command-line options -require "getopts.pl"; -&Getopts('hezf:s:'); +use Getopt::Std; + +our ($opt_h, $opt_e, $opt_z, $opt_f, $opt_s); +getopts('hezf:s:'); if ($@ || $opt_h) { &usage; } if ($opt_e) { $PrintInvalids = 1; } debian/patches/02-eof-defined.patch0000644000000000000000000001121211720167434014224 0ustar Description: Fix the EOF conditions - test with defined() Forwarded: yes Author: Tim Peeler Last-Update: 2010-08-06 --- a/wwwstat.pl +++ b/wwwstat.pl @@ -836,7 +836,7 @@ return; } - if ($_ = ) + if (defined($_ = )) { if (/^/) { &process_summary; } else { &process_log($_); } @@ -866,11 +866,11 @@ # The first thing to do is read past the HEAD and crossreferences # until we get to the first preformatted section (the totals) - do { return unless ($_ = ); } until ($_ eq $StartTag); + do { return unless (defined($_ = )); } until ($_ eq $StartTag); # Next line should be "Files Transmitted ..." or "Requests Received ..." - if (($_ = ) && (/\s(\d+)$/)) + if ((defined($_ = )) && (/\s(\d+)$/)) { return unless $1; $TotalRequests += $1; @@ -879,21 +879,21 @@ # Next line should be "Bytes Transmitted ..." - if (($_ = ) && (/\s(\d+)$/)) { $TotalBytes += $1; } + if ((defined($_ = )) && (/\s(\d+)$/)) { $TotalBytes += $1; } else { warn "Invalid summary file, skipping"; return; } # We don't care about the rest of the totals for (;;) # Loop through each section { - do { return unless ($_ = ); } until (/^$heading_tag/o); + do { return unless (defined($_ = )); } until (/^$heading_tag/o); next if (/>$PrefixTop /o); # Skip any Top N sections if (/$DailyHeader/o || /$OldDailyHeader/o) { - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S.*)/) { $date = $3; # the date after "|" @@ -906,8 +906,8 @@ elsif (/$HourlyHeader/o || /$OldHourlyHeader/o) { next unless $Do_Hourly; - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S+)/) { $hour = $3; # the hour after "|" @@ -920,8 +920,8 @@ elsif (/$DomainHeader/o || /$OldDomainHeader/o) { next unless $Do_Domain; - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S+)/) { $domain = $3; # the word after "|" @@ -934,8 +934,8 @@ elsif (/$SubdomainHeader/o || /$OldSubdomainHeader/o) { next unless $Do_Subdomain; - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S.*)/) { $subdomain = $3; @@ -948,8 +948,8 @@ elsif (/$ArchiveHeader/o || /$OldArchiveHeader/o) { next unless $Do_Archive; - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S.*)/) { $pathkey = &striplink($3); # the pathkey after "|" @@ -962,8 +962,8 @@ elsif (/$IdentHeader/o || /$OldIdentHeader/o) { next unless $Do_Ident; - do { return unless ($_ = ); } until (/^$table_rule/o); - while (($_ = ) && ($_ ne $EndTag)) + do { return unless (defined($_ = )); } until (/^$table_rule/o); + while ((defined($_ = )) && ($_ ne $EndTag)) { if (/\s(\d+)\s+(\d+)\s+\|\s+(\S.*)/) { $ident = $3; # the identity after "|" debian/patches/07-optimize.patch0000644000000000000000000003405711720167434013740 0ustar Description: Add Tim Peeler's Debian patch for wwwstat as a quilt patch. - add the --optimize command-line option for low-memory systems - split out some processing into self-contained routines Forwarded: yes Author: Tim Peeler , Peter Pentchev Last-Update: 2010-08-06 --- a/wwwstat.pl +++ b/wwwstat.pl @@ -13,6 +13,9 @@ # See the file README for more information. # See the wwwstat.1 man page for options and usage information. # +# Added an option to optimize for low memory systems. +# Tim Peeler + sub usage { die <<"EndUsage"; usage: $Pname [-F system_config] [-f user_config] [-helLoOuUrRvx] @@ -24,7 +27,7 @@ [-daily] [-hourly] [-domain] [-subdomain] [-archive] [-ident] [-all] [-sort (key|byte|req)] [-top N] [-both] [-no (daily|hourly|domain|subdomain|archive|ident|all)] - [--] [ logfile | summary | + | - ]... + [--optimize ] [--] [ logfile | summary | + | - ]... $Version Process a sequence of httpd Common Logfile Format access_log files and/or prior wwwstat output summary files (compressed if extension $Zhandle) @@ -32,6 +35,8 @@ Configuration options: -F Get system configuration defaults from the given file. -f Get user configuration defaults from the given file. + --optimize optimize for small memory systems, disables sorting + for hourly, domain, subdomain, archive and ident -- Last option (all later arguments are treated as filenames). Diagnostic Options: -h Help -- just display this message to STDERR and quit. @@ -237,6 +242,9 @@ $OldArchiveHeader = 'Total Transfers from each Archive Section'; $OldIdentHeader = 'Total Transfers to each Remote Identifier'; + $OptimizeMemory = 0; # should we optimize for memory usage? will + # disable sorting + # The following sets the default ordering for the daily stats. # Change this to 1 if you always want gwstat-style output. @@ -459,6 +467,10 @@ $TopSubdomain = $TopArchive = $TopIdent = $_; } } + elsif (/^optimize/) + { + $OptimizeMemory = 1; + } elsif (/^sort(.*)/) # Change sort method { unless ($_ = $1) { @@ -1386,6 +1398,19 @@ } # ========================================================================== +# Format a percentage value +# +sub format_pct +{ + my($part, $whole) = @_; + + if ($part == $whole) { + return '100.0'; + } + return sprintf("%5.2f", 100*$part/$whole); +} + +# ========================================================================== # Output the summary in HTML # sub output_summary @@ -1572,16 +1597,8 @@ { $rqsts = $DayRequests{$date} || 0; $bytes = $DayBytes{$date} || 0; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); - } + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $date; last if ($top && (--$top == 0)); @@ -1595,7 +1612,7 @@ sub output_hourly { local($frag) = @_; - local($rqsts, $bytes, $pctrqsts, $pctbytes); + local($rqsts, $bytes); local($top) = $TopHourly; local($prefix) = $top ? "$PrefixTop $top" : $PrefixTotal; @@ -1604,37 +1621,44 @@ print $StartTag; print $StatsHeader, " Time\n"; print $StatsRule, "-----\n"; - local($fmt) = "$StatsFormat %s\n"; - foreach $hour (sort hourcompare keys %HourRequests) - { - $rqsts = $HourRequests{$hour}; - $bytes = $HourBytes{$hour}; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); + if ($OptimizeMemory) { + while ( ($hour, $rqsts) = each %HourRequests) { + $bytes = $HourBytes{$hour}; + &print_hourly($rqsts, $bytes); + last if ($top && (--$top == 0)); + } + } else { + foreach $hour (sort hourcompare keys %HourRequests) + { + $rqsts = $HourRequests{$hour}; + $bytes = $HourBytes{$hour}; + &print_hourly($rqsts, $bytes); + last if ($top && (--$top == 0)); } - printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $hour; - - last if ($top && (--$top == 0)); } print $EndTag; } +sub print_hourly { + + my ($rqsts, $bytes) = @_; + local($pctrqsts, $pctbytes); + local($fmt) = "$StatsFormat %s\n"; + + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); + printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $hour; +} + # ========================================================================== # Output the stats for each requesting client's domain/country/organization # sub output_domain { local($frag) = @_; - local($rqsts, $bytes, $pctrqsts, $pctbytes); local($top) = $TopDomain; + local($rqsts, $bytes, $country); local($prefix) = $top ? "$PrefixTop $top" : $PrefixTotal; print "
\n"; @@ -1642,37 +1666,45 @@ print $StartTag; print $StatsHeader, " Domain\n"; print $StatsRule, "------------------------------------\n"; - local($fmt) = "$StatsFormat %-5s %s\n"; - foreach $domain (sort domaincompare keys %DomainRequests) - { - $country = $DomainMap{$domain} || ''; - $rqsts = $DomainRequests{$domain}; - $bytes = $DomainBytes{$domain}; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); + if ($OptimizeMemory) { + while ( ($domain, $rqsts) = each %DomainRequests) { + $country = $DomainMap{$domain} || ''; + $bytes = $DomainBytes{$domain}; + print_domain($country, $rqsts, $bytes); + last if ($top && (--$top == 0)); + } + } else { + foreach $domain (sort domaincompare keys %DomainRequests) + { + $country = $DomainMap{$domain} || ''; + $rqsts = $DomainRequests{$domain}; + $bytes = $DomainBytes{$domain}; + print_domain($country, $rqsts, $bytes); + last if ($top && (--$top == 0)); } - printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $domain, $country; - - last if ($top && (--$top == 0)); } print $EndTag; } +sub print_domain { + + my ($country, $rqsts, $bytes) = @_; + local($pctrqsts, $pctbytes); + local($fmt) = "$StatsFormat %-5s %s\n"; + + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); + printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $domain, $country; +} + # ========================================================================== # Output the stats for each requesting client's DNS subdomain # sub output_subdomain { local($frag) = @_; - local($rqsts, $bytes, $pctrqsts, $pctbytes); + local($rqsts, $bytes); local($top) = $TopSubdomain; local($prefix) = $top ? "$PrefixTop $top" : $PrefixTotal; @@ -1681,37 +1713,44 @@ print $StartTag; print $StatsHeader, " Reversed Subdomain\n"; print $StatsRule, "------------------------------------\n"; - local($fmt) = "$StatsFormat %s\n"; - foreach $subdomain (sort subdomcompare keys %SubdomainRequests) - { - $rqsts = $SubdomainRequests{$subdomain}; - $bytes = $SubdomainBytes{$subdomain}; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); + if ($OptimizeMemory) { + while ( ($subdomain, $rqsts) = each %SubdomainRequests ) { + $bytes = $SubdomainBytes{$subdomain}; + print_subdomain($rqsts, $bytes); + last if ($top && (--$top == 0)); + } + } else { + foreach $subdomain (sort subdomcompare keys %SubdomainRequests) + { + $rqsts = $SubdomainRequests{$subdomain}; + $bytes = $SubdomainBytes{$subdomain}; + print_subdomain($rqsts, $bytes); + last if ($top && (--$top == 0)); } - printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $subdomain; - - last if ($top && (--$top == 0)); } print $EndTag; } +sub print_subdomain { + + my ($rqsts, $bytes) = @_; + local($pctrqsts, $pctbytes); + local($fmt) = "$StatsFormat %s\n"; + + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); + printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $subdomain; +} + # ========================================================================== # Output the stats for each archive (URL path or category) # sub output_archive { local($frag) = @_; - local($rqsts, $bytes, $pctrqsts, $pctbytes, $asec); local($top) = $TopArchive; + local($rqsts, $bytes, $section); local($prefix) = $top ? "$PrefixTop $top" : $PrefixTotal; print "
\n"; @@ -1719,37 +1758,46 @@ print $StartTag; print $StatsHeader, " Archive Section\n"; print $StatsRule, "------------------------------------\n"; - local($fmt) = "$StatsFormat %s\n"; - foreach $section (sort archivecompare keys %ArchiveRequests) - { - $rqsts = $ArchiveRequests{$section}; - $bytes = $ArchiveBytes{$section}; - next unless $rqsts; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); - } - $asec = $section; - $asec =~ s/\&/\&/g; # Replace HTML specials - $asec =~ s//\>/g; - if ($InsertLink && ($asec =~ m:^/:)) { - $asec = "$asec"; + if ($OptimizeMemory) { + while ( ($section, $rqsts) = each %ArchiveRequests) { + $bytes = $ArchiveBytes{$section}; + next unless $rqsts; + print_archive($rqsts, $bytes, $section); + last if ($top && (--$top == 0)); + } + } else { + foreach $section (sort archivecompare keys %ArchiveRequests) + { + $rqsts = $ArchiveRequests{$section}; + $bytes = $ArchiveBytes{$section}; + next unless $rqsts; + print_archive($rqsts, $bytes, $section); + last if ($top && (--$top == 0)); } - printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $asec; - - last if ($top && (--$top == 0)); } print $EndTag; } +sub print_archive { + + my ($rqsts, $bytes, $section) = @_; + + local($pctrqsts, $pctbytes, $asec); + local($fmt) = "$StatsFormat %s\n"; + + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); + $asec = $section; + $asec =~ s/\&/\&/g; # Replace HTML specials + $asec =~ s//\>/g; + if ($InsertLink && ($asec =~ m:^/:)) { + $asec = "$asec"; + } + printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $asec; +} + # ========================================================================== # Output the stats for each calendar day represented in the input file(s) # @@ -1765,29 +1813,36 @@ print $StartTag; print $StatsHeader, " Remote Identity\n"; print $StatsRule, "------------------------------------\n"; - local($fmt) = "$StatsFormat %s\n"; - foreach $ident (sort identcompare keys %IdentRequests) - { - $rqsts = $IdentRequests{$ident}; - $bytes = $IdentBytes{$ident}; - if ($rqsts == $TotalRequests) { - $pctrqsts = "100.0"; - } else { - $pctrqsts = sprintf("%5.2f", 100*$rqsts/$TotalRequests); - } - if ($bytes == $TotalBytes) { - $pctbytes = "100.0"; - } else { - $pctbytes = sprintf("%5.2f", 100*$bytes/$TotalBytes); + if ($OptimizeMemory) { + while ( ($ident, $rqsts) = each %IdentRequests) { + $bytes = $IdentBytes{$ident}; + print_ident($rqsts, $bytes); + last if ($top && (--$top == 0)); + } + } else { + foreach $ident (sort identcompare keys %IdentRequests) + { + $rqsts = $IdentRequests{$ident}; + $bytes = $IdentBytes{$ident}; + print_ident($rqsts, $bytes); + last if ($top && (--$top == 0)); } - printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $ident; - - last if ($top && (--$top == 0)); } print $EndTag; } +sub print_ident { + + my ($rqsts, $bytes) = @_; + local($pctrqsts, $pctbytes); + local($fmt) = "$StatsFormat %s\n"; + + $pctrqsts = format_pct($rqsts, $TotalRequests); + $pctbytes = format_pct($bytes, $TotalBytes); + printf $fmt, $pctrqsts, $pctbytes, $bytes, $rqsts, $ident; +} + # ========================================================================== # ========================================================================== # The following sort comparison functions take $a and $b as the two debian/patches/01-debian.patch0000644000000000000000000000316711720167434013312 0ustar Description: Use the Debian filesystem layout. Use perl -w. Use the Debian location of the Perl interpreter, the Apache logfile, and the domains.pl file installed by this package. Forwarded: not-needed Author: Tim Peeler Last-Update: 2010-08-02 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ # You need to change the following line to the full pathname # of your perl interpreter -PERLBIN = /usr/local/bin/perl +PERLBIN = /usr/bin/perl # and here are a some commands that may be system-dependent @@ -26,7 +26,7 @@ .pl: cp $*.pl $* - $(PERLBIN) -pi -e 's#YOUR_PERL_BINARY#$(PERLBIN)#o;' $* + $(PERLBIN) -pi -e 's#YOUR_PERL_BINARY#$(PERLBIN) -w#o;' $* chmod 755 $* # --- a/splitlog.rc +++ b/splitlog.rc @@ -40,7 +40,7 @@ # # Specify the default location of your access log # -## $DefaultLog = '/usr/local/etc/httpd/logs/access_log'; +## $DefaultLog = '/var/log/apache/access.log'; # # Specify the default destination directory for the split logfiles # --- a/wwwstat.rc +++ b/wwwstat.rc @@ -92,7 +92,7 @@ # # Specify the default location of your access log # -## $DefaultLog = '/usr/local/etc/httpd/logs/access_log'; +## $DefaultLog = '/var/log/apache/access.log'; # # Specify the command for displaying compressed files to STDOUT # --- a/wwwstat.pl +++ b/wwwstat.pl @@ -131,7 +131,7 @@ { @ArchiveMap = (); - require "domains.pl"; # Get the domain mapping (%DomainMap) + require "/usr/lib/wwwstat/domains.pl"; # Get the domain mapping (%DomainMap) # Specify the URL of the previous summary period (for use only as a # hypertext link). Set it = "" if link is unwanted. debian/wwwstat.install0000644000000000000000000000017111720167434012302 0ustar domains.pl usr/lib/wwwstat monthly oldlog2new splitlog wwwerrs wwwstat usr/sbin *.rc etc/wwwstat debian/*.rc etc/wwwstat debian/compat0000644000000000000000000000000211724254511010366 0ustar 9 debian/docs0000644000000000000000000000010311720167434010040 0ustar FAQ example.html splitlog.html wwwstat.html splitlog.ps wwwstat.ps debian/wwwstat.doc-base0000644000000000000000000000103111720167434012305 0ustar Document: wwwstat Title: wwwstat manual Author: Roy Fielding Abstract: wwwstat reads a sequence of httpd common logfile format (CLF) access_log files and/or prior wwwstat output summary files and/or the standard input and outputs a summary of the access statistics in HTML. Section: System/Administration Format: Text Files: /usr/share/doc/wwwstat/FAQ.gz Format: HTML Index: /usr/share/doc/wwwstat/wwwstat.html Files: /usr/share/doc/wwwstat/*.html Format: PostScript Files: /usr/share/doc/wwwstat/*.ps.gz debian/dirs0000644000000000000000000000011611720167346010057 0ustar usr/sbin etc/wwwstat usr/lib/wwwstat usr/share/doc/wwwstat usr/share/man/man8 debian/monthly.80000644000000000000000000000276011720167430010757 0ustar .\" Copyright (c) 2004 Tim Peeler .\" All rights reserved. The file LICENSE (the Artistic License) .\" specifies the terms and conditions for redistribution. .\" .if n .tr \-- .if n .tr \(buo .if n .tr \(em- .TH monthly 8 "18 November 2004" .if n .ad l .SH NAME monthly \- httpd log rotation for wwwstat .SH SYNOPSIS .HP 8 .B monthly .SH DESCRIPTION .nh .B THIS PROGRAM MUST ONLY BE RUN ONCE PER MONTH! DURING THE FIRST WEEK It assumes a lot, like that you use wwwstat and archive your logfiles once per month. You will need to configure it for your server before it can be used. .LP Reads the logfile (assumed to contain more than one month's worth of WWW common logfile entries) and moves the prior month's entries into a separate file. The new file is created on TMPDIR (to avoid filling up the disk), compressed using gzip, and then moved to the archive directory. The program also restarts the httpd server. .LP .SH SEE ALSO .BR crontab (1), .BR httpd (1m), .BR perl (1), .BR wwwstat (1), .BR splitlog (1), .BR wwwerrs (8), .BR oldlog2new (8) .LP More info and the latest version of monthly can be obtained from .LP http://www.ics.uci.edu/pub/websoft/wwwstat/ ftp://www.ics.uci.edu/pub/websoft/wwwstat/ .LP If you have any suggestions, bug reports, fixes, or enhancements, please join the mailing list by sending e-mail with "subscribe" in the subject of the message to the request address . The list is archived at the above address.