Bug 767532 - Awstats do not compute stats
Summary: Awstats do not compute stats
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: awstats
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Lautrbach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-14 10:12 UTC by Pierre Blavy
Modified: 2012-02-07 16:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 14:26:21 UTC
Type: ---


Attachments (Terms of Use)

Description Pierre Blavy 2011-12-14 10:12:50 UTC
Description of problem:
Awstats logs always say 0 visits.

Version-Release number of selected component (if applicable):
Last one 

How reproducible:
Always

Steps to Reproduce:
1. install & configure awstats, 
2. restart httpd, 
3. visit your site
4. check stats
  
Actual results:
Stats are always 0


Expected results:
Have stats

FIX :
awstats is runned with apache user, but logs are owned by root. 
chmod a+x /var/log/httpd
chmod a+r /var/log/httpd/access_log

awstats is runned with apache user, but need to store file in /var/lib/awstats which is own by root.
chown apache:apache /var/lib/awstats

Comment 1 Petr Lautrbach 2012-01-02 09:57:33 UTC
You might have hit same problem as bug #768982.

Stats are updated with cron script /etc/cron.hourly/awstats by default and this script is run with root privileges.

What is your configuration?

Comment 2 Pierre Blavy 2012-01-16 10:22:15 UTC
Helo Petr,
what do you exactly means by ``configuration''?
I've tryed to reconfigure everything from scratch, and I can still reproduce the bug, here is a full list of what I've done.


# --- New install ---
yum remove awstats
rm /etc/httpd/conf.d/awstats.conf.rpmsave
rm -rf /etc/awstats
rm -rf /var/lib/awstats

yum install awstats
nano /etc/httpd/conf.d/awstats.conf (see detail below)
htpasswd /etc/awstats/awstats.pwd user...
service httpd restart




#--- Configure ---
The file /etc/awstats/awstats.tentacule.conf was magickly created by the installation
I've changed the following lines
SiteDomain="tentacule" --> SiteDomain="tentacule.be"
HostAliases="REGEX[^.*tentacule$]" --> HostAliases="REGEX[^.*tentacule$] tentacule.is-a-geek.com"
AllowFullYearView=2 --> AllowFullYearView=3
DNSLookup=2 --> DNSLookup=1
AllowToUpdateStatsFromBrowser=0 --> AllowToUpdateStatsFromBrowser=1



#--- Test from scratch WRONG PERMISSIONS ---
Clean firefox cache
login on stat web page (my page is in french, I've translated it)
https://tentacule.be/awstats/awstats.pl?config=tentacule

Dernière mise à jour: 	Jamais mis à jour (Voir 'Build/Update', page awstats_setup.html)
Last update : Never updated(See 'Build/Update', page awstats_setup.html)

--> click on `` Mise à jour immédiate'' (update now)

Error: Couldn't open file "/var/lib/awstats/awstats012012.tentacule.tmp.1951" for write: Permission denied

Setup ('/etc/awstats/awstats.tentacule.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory). 



#--- Fixing permission ---
This error happens because awstats is runed by apache, while /var/lib/awstats/ is owned by root.

An easy fix (that may have been done with the package install is) : 
chown apache:apache /var/lib/awstats

Clean firefox cache
Click on update now
--> Stats works...




#--- Testing the cron script FAIL ---
- Visit some webpages in firefox
- clean my firefox cache
- run as root : 
/usr/share/awstats/tools/awstats_updateall.pl now         -configdir="/etc/awstats"         -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl"
- visit the awstats webpage


I get no errors with the update script (full log below)
I DO NOT SEE ANY changes in the awstat webpage
If I click again on the update now button, the changes are taken into account.

--> Something is probably messed up with the cron script.





--- /etc/cron.hourly/awstats ---
#!/bin/bash
exec /usr/share/awstats/tools/awstats_updateall.pl now         -configdir="/etc/awstats"         -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" >/dev/null
exit 0



--- /etc/httpd/conf.d/awstats.conf ---

# default
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"

#My config
<Directory "/usr/share/awstats/wwwroot">
   AuthName "Stats"
   AuthType Basic
   AuthUserFile /etc/awstats/awstats.pwd
   require valid-user
</Directory>

#Default
<IfModule mod_env.c>
    SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
</IfModule>





--- Cron script output ---
Running '"/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=localhost.localdomain -configdir="/etc/awstats"' to update config localhost.localdomain
Create/Update database for config "/etc/awstats/awstats.localhost.localdomain.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 1967
 Found 1959 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 8 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.

Running '"/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=tentacule -configdir="/etc/awstats"' to update config tentacule
Create/Update database for config "/etc/awstats/awstats.tentacule.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 1932)
Jumped lines in file: 1932
 Found 1932 already parsed records.
Parsed lines in file: 35
 Found 35 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.



--- /etc/awstats/awstats.tentacule.conf ---
https://tentacule.be/share/awstats.tentacule.conf

Comment 3 Petr Lautrbach 2012-01-16 11:50:46 UTC
(In reply to comment #2)
> AllowToUpdateStatsFromBrowser=0 --> AllowToUpdateStatsFromBrowser=1
>
> #--- Test from scratch WRONG PERMISSIONS ---
> Clean firefox cache
> login on stat web page (my page is in french, I've translated it)
> https://tentacule.be/awstats/awstats.pl?config=tentacule
> 
> Dernière mise à jour:  Jamais mis à jour (Voir 'Build/Update', page
> awstats_setup.html)
> Last update : Never updated(See 'Build/Update', page awstats_setup.html)
> 
> --> click on `` Mise à jour immédiate'' (update now)
> 
> Error: Couldn't open file "/var/lib/awstats/awstats012012.tentacule.tmp.1951"
> for write: Permission denied
> 
> Setup ('/etc/awstats/awstats.tentacule.conf' file, web server or permissions)
> may be wrong.
> Check config file, permissions and AWStats documentation (in 'docs' directory). 

There is comment in DirData section:

# Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
# feature (see later), you need "Write" permissions by web server user on this
# directory (and "Modify" for Windows NTFS file systems).

As long as AllowToUpdateStatsFromBrowser is set to 0 by default, apache doesn't need to write in awstats files. I won't change these permissions  by default considering this is potentially vulnerable configuration - other cgi script would be allowed to change awstats files. You need to change them manually. 


> 
> 
> #--- Testing the cron script FAIL ---
> - Visit some webpages in firefox
> - clean my firefox cache
> - run as root : 
> /usr/share/awstats/tools/awstats_updateall.pl now        
> -configdir="/etc/awstats"        
> -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl"
> - visit the awstats webpage
> 
> 
> I get no errors with the update script (full log below)
> I DO NOT SEE ANY changes in the awstat webpage
> If I click again on the update now button, the changes are taken into account.
> 
> --> Something is probably messed up with the cron script.
> 
> 
> 
> 
> 
> --- /etc/cron.hourly/awstats ---
> #!/bin/bash
> exec /usr/share/awstats/tools/awstats_updateall.pl now        
> -configdir="/etc/awstats"        
> -awstatsprog="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" >/dev/null
> exit 0
> 
> 
> 
> --- Cron script output ---
> Running '"/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -update
> -config=localhost.localdomain -configdir="/etc/awstats"' to update config
> localhost.localdomain
> Create/Update database for config
> "/etc/awstats/awstats.localhost.localdomain.conf" by AWStats version 7.0 (build
> 1.971)
> From data in log file "/var/log/httpd/access_log"...
> Phase 1 : First bypass old records, searching new record...
> Searching new records from beginning of log file...
> Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
> Jumped lines in file: 0
> Parsed lines in file: 1967
>  Found 1959 dropped records,
>  Found 0 comments,
>  Found 0 blank records,
>  Found 8 corrupted records,
>  Found 0 old records,
>  Found 0 new qualified records.
> 
> Running '"/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -update
> -config=tentacule -configdir="/etc/awstats"' to update config tentacule
> Create/Update database for config "/etc/awstats/awstats.tentacule.conf" by
> AWStats version 7.0 (build 1.971)
> From data in log file "/var/log/httpd/access_log"...
> Phase 1 : First bypass old records, searching new record...
> Direct access after last parsed record (after line 1932)
> Jumped lines in file: 1932
>  Found 1932 already parsed records.
> Parsed lines in file: 35
>  Found 35 dropped records,
>  Found 0 comments,
>  Found 0 blank records,
>  Found 0 corrupted records,
>  Found 0 old records,
>  Found 0 new qualified records.
> 


This is probably problem described in bug #771031, please try awstats-7.0-6.fc16 [1] update.

[1] https://admin.fedoraproject.org/updates/FEDORA-2012-0021/awstats-7.0-6.fc16

Comment 4 Petr Lautrbach 2012-02-07 14:26:21 UTC
Given comment #3 and package update, I'm closing this one as WORKSFORME. Feel free to reopen it, if updated package haven't solved your problem.

Comment 5 Pierre Blavy 2012-02-07 16:07:12 UTC
Works for me now.
Thank.


Note You need to log in before you can comment on or make changes to this bug.