Ubuntu: Webalizer shows only 2 months on summary page (Ubuntu 14.04)


Webalizer used to show 12 Months on start page's summary, in a graphical overview as well in a link list to each of this month and the 11 months before. This worked out of the box at least in Ubuntu 10.04 and 12.04, I only had to configure incremental mode to deal with my daily (not monthly) log files.

After moving two websites to 14.04, I found webalizer messing with the summary, in a way that it showed only two months in the grapical overview, 10 slots for the other months were empty. The link list shows the same two months only (this month and last month). If I omit log data of May and June, I get March and April - again two months only.

I tried to omit incremental mode (using default config file) and handed webalizer a single log file containing 30 months of logs. This resulted in webalizer creating a summary graphic and link list of 11 times May and 1 time June.

Important to notice: monthly statistics look correct, even those of three or more months ago, I just have to type the URL by hand of any statistics entry more than 2 months ago.

I searched the web with any combinations of "webalizer", "two months", "only", etc. and found only one question like this - but without any answer.

Any ideas folks, what's wrong or what I might be doing wrong?

Ok, of course you want to see more exactly what I've tried, so I'll include command line examples of what I tried:

$ logdir=/path-to-logdir  $ ls $logdir  ...  2015.0617-access.log.gz  2015.0618-access.log.gz  2015.0619-access.log.gz  $ outputdir=/path-to-webroot/statistics  $ rm $outputdir/*  $ for logfile in $logdir/*-access.log.gz;  do webalizer -r http://$hostname -n $hostname -o $outputdir $logfile;  done  ... lots of verbose output about webalizer's activity  ... last of it being:  Webalizer V2.23-08 (Linux 3.13.0-55-generic x86_64) locale: htm*  Using logfile /path-to-logdir/2015.0619-access.log.gz (gzip-clf)  Creating output in /path-to-webroot/statistics  Hostname for reports is 'myhostname'  Reading history file... webalizer.hist  Reading previous run data.. webalizer.current  Saving current run data... [06/19/2015 23:27:09]  Generating report for June 2015  Saving history information...  Generating summary report  20 records in 1 seconds, 20/sec  $   

This resulted in only two months in total summary, but monthly summaries (even those older than 2 months) were created and accessible via manually typed URL.

Another try (all data at once - non-incremental) was:

$ zcat $logdir/*-access.log.gz >/tmp/access.log  $ rm $outputdir/*  $ webalizer -r http://$hostname -n $hostname -o $outputdir /tmp/access.log  ... lots of verbose output just as before  $   

Similar result, but total summary had 11 entries May and one entry June.

Who can help to get correct summaries?

Thank you, TomTomTom

=================================================== EDIT: I've corrected some typos, and I've done more tests

Not a single answer or comment during more than 24 hours - looks like this webalzer stuff is not so prominent. Well, this is what I've done:

  • I copied the log files to a notebook with fresh install of 14.04 - same results
  • I dropped log files created by 14.04's apache - same result
  • I grabbed webalizer's source and compiled it on two different 14.04 machines - this one workes, finally.

Does that mean Ubuntu-14.04's webalizer package is broken? For longer than one year now? Hard to believe.

If nobody can explain what's gone wrong, at least for those of you looking for webalizer summary problems - you've found it's not yours alone.

I'll be happy to hear about others who have similar webalizer problems - and even more happy of course, if someone can point me to a solution which doesn't require compiling webalizer sources.

Thank you!



It's a known bug, and there's a patch: https://bugs.launchpad.net/ubuntu/+source/webalizer/+bug/1471387


Well, I've got the same problem, Fedora box though. And no solution either. I use a "workaround", based on a script I found at http://stevehavelka.com/rebuilding-broken-webalizer-history-tcl/, with which you recreate the history file. It's dirty, copy-paste-style, but it works. At least for one month (that is, until webalizer recreates the index page and overwrites the history file):

#!/bin/sh  #Using this script is straightforward:  #  # 1. Run it within the folder that has your old webalizer files, and it produces as much historical data as it can.  # 2. Copy/paste that historical data into your webalizer.hist file, and rerun Webalizer.  # 3. That’s it!  You should have all your stats back.  #  # the next line restarts using tclsh \  exec tclsh "$0" "$@"    # first, find the right files  foreach file [lsort -decreasing [glob usage_*.html]] {        # and get the date from the files      regexp {usage_(\d{4})(\d\d).html} $file -> year month        # open the file to get some data from it      set fh [open $file r]      set text [list]      while { ![eof $fh] } {          lappend text [gets $fh]      }      close $fh        # now start pulling out data with Total Hits      set idx [lsearch -glob $text {*Total Hits*}]      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalHits        # Total Files      set idx [lsearch -glob $text {*Total Files*}]      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalFiles        # Total Unique Sites      set idx [lsearch -glob $text {*Total Unique Sites*}]      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalUniques        # Total kB Files      set idx [lsearch -glob $text {*Total kB Files*}]      if { $idx == -1 } {          set idx [lsearch -glob $text {*Total KBytes*}]      }      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalKb        # Process days      set first [lsearch -glob $text {*Daily Statistics for*}]      set last [lsearch -glob $text {*Hourly Statistics for*}]      set subtext [lrange $text $first $last]      set dates [lsearch -glob -all -inline $subtext {<TR*><TD ALIGN=center><FONT SIZE="-1"><B>*</B></FONT></TD>}]        # First day processed      regexp {<B>(\d+)</B>} [lindex $dates 0] -> firstDay        # Last day processed      regexp {<B>(\d+)</B>} [lindex $dates end] -> lastDay        # Total Pages      set idx [lsearch -glob $text {*Total Pages*}]      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalPages        # Total Visits      set idx [lsearch -glob $text {*Total Visits*}]      regexp {<B>(\d+)</B>} [lindex $text $idx+1] -> totalVisits        # and that's it!      puts "[string trimleft $month 0] $year $totalHits $totalFiles $totalUniques $totalKb $firstDay $lastDay $totalPages $totalVisits"    }  

As stated, put this script into the directory containing the stats summaries, execute it and copy-paste the result into your webalizer.hist file. There you go.

This probably means that writing back the history into the history file doesn't work as expected. Since I've got no idea whatsoever where to look at in the source, I hope somebody else can shed more light on that issue... Any suggestion welcome.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »