[Tutorial] integrating Awstats in Centos Web Panel

Started by bullten, August 30, 2018, 11:10:08 AM

Previous topic - Next topic

jeniha

Create/Update database for config "/etc/awstats/awstats.www.salespc.net.conf" by AWStats version 7.7 (build 20180105)
From data in log file "/usr/local/apache/logs/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 /usr/local/apache/logs/access_log must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
1
This means each line in your web server log file need to have "combined log format" like this:
111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
And this is an example of records AWStats found in your log file (the record number 50 in your log):
192.168.3.4 - - [31/Aug/2018:16:13:03 +0300] "GET /awstatsicons/clock/hr11.png HTTP/1.0" 304 -
Setup ('/etc/awstats/awstats.www.salespc.net.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

bullten

Its not working before of log format error. When you were installing awstats it must have asked you to fix log format. Did you checked no for it?

Also what is output of

cat /usr/local/apache/conf/httpd.conf | grep LogFormat

jeniha

I didnt remember.
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

bullten

output of

tail -f /usr/local/apache/logs/access_log

jeniha

192.168.3.4 - - [31/Aug/2018:16:32:06 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:07 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:10 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:12 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:14 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:16 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:17 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:18 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:20 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:21 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324
192.168.3.4 - - [31/Aug/2018:16:32:23 +0300] "POST //xmlrpc.php HTTP/1.0" 503 21324


bullten

Well this is not absolutely correct output it needs. you are behind nginx and that may be causing issue.

rm -rf /usr/local/apache/logs/access_log
service httpd restart
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.salespc.net

If the above doesnt work. Temporarily disable nginx and run the above commands again and then check if it updates

jeniha

Then cant work with ngix?Chance to work it or some alternative?

bullten

I dont know if actually it is causing issue. I would suggest you to contact your server admin regarding it once.

bullten

last thing you can do is to check if your apache is using combined log format

cat /usr/local/apache/conf/httpd.conf | grep combined

jeniha

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    #CustomLog "logs/access_log" combined

bullten

nano /usr/local/apache/conf/httpd.conf

find line

#CustomLog "logs/access_log" combined

Uncomment it and save it

run below commands again.

rm -rf /usr/local/apache/logs/access_log
service httpd restart
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.salespc.net

jeniha

there is not that line in this file?
Did i need to add it?

bullten

add the below command at the end of your httpd.conf file

CustomLog "logs/access_log" combined

jeniha

WORK!
Where was the problem actualy?
And 10x for you time and help.

bullten

Well when you install awstats it asks you to automatically fix combined logs but at that time you pressed N and it didnt do that. That was the issue.