looking in /usr/lib/cgi-bin instead of /etc/awstats

Bug #1181790 reported by Moses Moore on 2013-05-19
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
awstats (Ubuntu)
Medium
Unassigned

Bug Description

What I did:
# su - www-data
$ /usr/lib/cgi-bin/awstats.pl -config=equius.mozai.com -update

What I expected:
Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 7.0 (build dfsg-5)
From data in log file ...
(etc etc etc)

What I see instead:
Error: LogFile parameter is not defined in config/domain file
Setup ('equius.mozai.com' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

Other information:
$ pwd
/var/www
$ ls -l /etc/awstats/awstats.equius.mozai.com.conf
-rw-r--r-- 1 root root 617 May 11 2012 /etc/awstats/awstats.equius.mozai.com.conf
$ strace /usr/lib/cgi-bin/awstats.pl -config=equius.mozai.com -update 2>&1 |grep open
open("/usr/lib/cgi-bin/awstats.equius.mozai.com.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/cgi-bin/awstats.conf", O_RDONLY) = -1 ENOENT (No such file or directory)

I expected the software to look in /etc/awstats/ for the config files, or maybe the current working directory, not /usr/lib/cgi-bin/. The documentation at https://help.ubuntu.com/community/AWStats also describes putting the config files in /etc/awstats/, not in /usr/lib/cgi-bin/.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: awstats 7.0~dfsg-5
Uname: Linux 2.6.32-042stab076.8 x86_64
ApportVersion: 2.0.1-0ubuntu17.2
Architecture: amd64
Date: Sun May 19 11:51:16 2013
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=screen-256color
 PATH=(custom, no user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
SourcePackage: awstats
UpgradeStatus: Upgraded to precise on 2012-12-06 (163 days ago)
modified.conffile..etc.awstats.awstats.conf: [modified]
modified.conffile..etc.awstats.awstats.conf.local: [modified]
modified.conffile..etc.cron.d.awstats: [modified]
mtime.conffile..etc.awstats.awstats.conf: 2013-05-06T23:51:36.204526
mtime.conffile..etc.awstats.awstats.conf.local: 2012-01-10T22:06:09
mtime.conffile..etc.cron.d.awstats: 2012-12-06T16:31:53

Moses Moore (moses-mozai) wrote :
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I cannot reproduce this on awstats 7.0~dfsg-5 on Precise.

I did:

apt-get install awstats
/usr/lib/cgi-bin/awstats.pl -config=yourdomain.ext -update

I got:

Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats.
Setup ('/etc/awstats/awstats.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

So it looks like awstats.pl is looking in /etc/awstats as expected.

strace -eopen lists the following relevant file open attempts:

open("/usr/lib/cgi-bin/awstats.yourdomain.ext.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/cgi-bin/awstats.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("yourdomain.ext", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/awstats/awstats.yourdomain.ext.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/awstats/awstats.conf", O_RDONLY) = 3
open("/etc/awstats/awstats.conf.local", O_RDONLY) = 4

I then installed apache2, and set SiteDomain to "example.com" in /etc/awstats/awstate.conf.

Then:

# /usr/lib/cgi-bin/awstats.pl -config=example.com -update
Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 0
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 0 new qualified records.

Note that www-data cannot read /var/log/apache2/ by default. Are you sure that your problem isn't just that you should be running awstats.pl -update as something that can read the logs? I just used the documentation you pointed to.

If this turns out to be a local misconfiguration, please change the bug status to Invalid. Otherwise, please set the bug status to New after you have responded.

Changed in awstats (Ubuntu):
status: New → Incomplete
Launchpad Janitor (janitor) wrote :

[Expired for awstats (Ubuntu) because there has been no activity for 60 days.]

Changed in awstats (Ubuntu):
status: Incomplete → Expired
Stuart Langridge (sil) wrote :

I've just experienced this same problem; awstats was correctly looking at my conf file /etc/awstats/awstats.my.domain.conf and then it stopped working -- turning on -debug=2 (easier than strace!) shows that awstats started looking in /usr/lib/cgi-bin for the conf file. I'd changed various things about my awstats conf, so I don't know what I did that tripped the problem. I have worked around it by explicitly specifying the whole path to the conf file, so "awstats -config /etc/awstats/awstats.my.domain.conf -update", which works. Quite why "-config my.domain" now does not work is baffling. I can confirm that the problem is not about user permissions on files: awstats is explicitly looking in /usr/lib/cgi-bin for conf files, and I run the command as root.

Changed in awstats (Ubuntu):
status: Expired → New
Robie Basak (racb) on 2013-10-24
Changed in awstats (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers