Opened 5 months ago

Closed 4 months ago

#13769 closed Feature/Enhancement Request (fixed)

AWStats reliability improvement suggestion

Reported by: https://id.mayfirst.org/wolcen Owned by: https://id.mayfirst.org/jamie
Priority: Medium Component: Tech
Keywords: awstats statistics log cron Cc:
Sensitive: no

Description (last modified by https://id.mayfirst.org/wolcen)

Hi all,

I ran into a situation with a poorly scheduled awstats run. Basically, the situation is this: if the awstats script to generate everything is run close enough to the end of the hour, when it finishes log parsing and begins the report page generation, when a month/year is not supplied, it will skip to processing the subsequent - at the time current - month. For example, our report that ended up in the 201801 folder contained the report for the very beginning of Feb 1 2018 only. If the month/year is added to the call to awstats, this can be avoided.

In order to be able to schedule it effectively, I would suggest a changes such as the following:

25c25,28
< date=`date +%Y%m`
---
> date=`date --date="-1 hour"`
> year=`date --date="$date" +%Y`
> month=`date --date="$date" +%m`
> ym=$year$month
28,29c31,32
< if [ ! -d $dir/$date ]; then
<         mkdir $dir/$date;
---
> if [ ! -d $dir/$ym ]; then
>         mkdir $dir/$ym;
33c36
< /usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$config -update -awstatsprog=/usr/lib/cgi-bin/awstats.pl -dir=$dir/$date/ -configdir=/etc/awstats
---
> /usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$config -update -awstatsprog=/usr/lib/cgi-bin/awstats.pl -dir=$dir/$ym/ -configdir=/etc/awstats -month=$month -year=$year

This way we should be good to run at the turn of the hour and nothing at the end of a month would be missed.

Edited to correct doubled-dash to single dash for date params.

Attachments (1)

mf-awstats-build-staticpages (971 bytes) - added by https://id.mayfirst.org/wolcen 5 months ago.
Updated mf-awstats-build-staticpages

Download all attachments as: .zip

Change History (7)

Changed 5 months ago by https://id.mayfirst.org/wolcen

Updated mf-awstats-build-staticpages

comment:1 Changed 5 months ago by https://id.mayfirst.org/wolcen

  • Description modified (diff)

comment:2 Changed 5 months ago by https://id.mayfirst.org/jamie

  • Owner set to https://id.mayfirst.org/jamie
  • Status changed from new to assigned

comment:3 Changed 5 months ago by https://id.mayfirst.org/jamie

Awesome! Thank you wolcen - I just pushed the change to our puppet repo.

Which server are you testing on? I'd like to push the changes to your server so you can confirm that things are still working well before pushing out everywhere.

comment:4 Changed 4 months ago by https://id.mayfirst.org/wolcen

Hi Jamie - sorry for the delay, was out on a short break.

We've been working on portside's stats (newportside on mumia).

Thanks!

comment:5 Changed 4 months ago by https://id.mayfirst.org/jamie

Excellent - the changes are in place on mumia. Let us know if I got it right :)

comment:6 Changed 4 months ago by https://id.mayfirst.org/wolcen

  • Resolution set to fixed
  • Status changed from assigned to closed

The June statistics just updated as expected. Nice :)

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.