Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
trouble setting up awstats
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1029

PostPosted: Mon Nov 11, 2019 12:40 pm    Post subject: trouble setting up awstats Reply with quote

I am trying to setup awstats following this instructions on gentoo wiki.

My first question would be, if I understood it correctly that if I have multiple domains, I setup these variables:

Code:
SiteDomain="mydomain1.com"
HostAliases="localhost 127.0.0.1 REGEX[mydomain1\.com$] REGEX[mydomain2\.com$]


The wiki states:
Code:
Also, awstats needs to store its database somewhere. Gentoo has created /var/lib/awstats for this use, but it can be stored anywhere. Make sure the permissions are set so that the apache user can write to it


So I did
Code:
chown apache:apache /var/lib/awstats/

Is this correct?

Then I am supposed to issue
Code:
awstats.pl -config=stats.mydomain.com -update -showdropped


But this should be
Code:
awstats.pl -config=mydomain.com -update -showdropped
as the config file was named awstats.mydomain.com following the wiki article and not awstats.stats.mydomain.com, right? Else awstats.pl states
Code:
Error: Couldn't open config file "awstats.stats.mydomain.com.conf", nor "awstats.conf", nor "stats.mydomain.com" after searching in path "/usr/bin, /etc/awstats, /usr/local/etc/awstats, /etc, /etc/opt/awstats, stats.mydomain.com": No such file or directory


By issuing
Code:
awstats.pl -config=example.com -update -showdropped
I get
Code:
Warning: Can't find language files for "en". English will be used.
Error: Plugin init for plugin 'geoip' failed with return code: Error: Failed to create gi object for datafile=/usr/share/GeoIP/GeoIP.dat
Setup ('/etc/awstats/awstats.mydomain.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

Code:
ls -l /usr/share/GeoIP/
total 0


How can I avoid the Language warning message? Setting Lang=de or en does not help.

Not knowing what the problem with GeoIP is I commented the corresponding line out
Code:
#LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"

after having checked, that chown apache:apache /usr/share/GeoIP did not change anything.

Now I get:
awstats.pl -config=mydomain.com -update -showdropped
Code:
Warning: Can't find language files for "en". English will be used.
Create/Update database for config "/etc/awstats/awstats.mydomain.com.conf" by AWStats version 7.4 (build 20150714)
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...
AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file /var/log/apache2/access_log must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
%virtualname %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot
This means each line in your web server log file need to have the following personalized log format:
%virtualname %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot
And this is an example of records AWStats found in your log file (the record number 50 in your log):
127.0.0.1 - - [10/Nov/2019:11:14:42 +0100] "OPTIONS * HTTP/1.0" 200 -
Setup ('/etc/awstats/awstats.mydomain.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).


So what would be a working LogFormat parameter, that would correspond with my default apache access_log entries configuration?
If anyone can help me to sort those misconfigurations out, I would be very glad. Trying to follow the wiki I seem not able to set this up correctly.
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1029

PostPosted: Mon Nov 11, 2019 10:56 pm    Post subject: Reply with quote

Reading the wiki again I see:

Quote:
For one, awstats assumes that vhosts aren't used. When using apache's default combined vhost logs for example, awstats will fail to run.

Assume apache's combined LogFormat is setup as follows:
Apache's LogFormat

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost


Maybe this is my problem? I have no idea where to check apache's LogFormat configuration. I can only say, that it must be default, as I did not touch it.
Back to top
View user's profile Send private message
sliwowitz
Apprentice
Apprentice


Joined: 21 Jan 2005
Posts: 209
Location: Europe/Prague

PostPosted: Thu Jan 09, 2020 3:38 pm    Post subject: Reply with quote

1. I was able to make GeoIP work by manually downloading the file to a custom directory
Code:
mkdir /usr/local/share/GeoIP
cd /usr/local/share/GeoIP
wget https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/GeoIP.dat.gz
gunzip GeoIP.dat.gz

and changing the file location line in awstats.yoursite.conf to
Code:
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP"


2. The apache LogFormat configuration is in /etc/apache2/modules.d/00_mod_log_config.conf. Comment out the "CustomLog /var/log/apache2/access_log common" line, and uncomment the "CustomLog /var/log/apache2/access_log combined" line near the bottom of the file. You will also have to flush/rotate (or just remove) the old log files, and restart apache.
_________________
The question of whether Machines Can Think... is about as relevant as the question of whether Submarines Can Swim.
-- Edsger Dijkstra
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum