Control Web Panel

WebPanel => How to => Topic started by: bullten on August 30, 2018, 11:10:08 AM

Title: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 30, 2018, 11:10:08 AM
Below is tutorial to install and access awstats in cwp

Code: [Select]
https://panel.bullten.net/knowledgebase/71/Adding-and-integrating-Awstats-in-CWP--Centos-6or7.html
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 06:44:03 AM
I use this tutorial, but stats wont update.
Last update: never update, shows on top of page.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 07:56:40 AM
You need to add cronjob as mentioned in tutorial.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 08:20:30 AM
Yes i used this: crontab -l | { cat; echo "* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp"; } | crontab -
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 12:33:56 PM
what did you choose domain when you were installing awstats?

what is output of crontab -l
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 12:49:42 PM
31 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh/cwp_certs" > /                                                                                                                                                                                                                                             dev/null
05 01 * * * /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admi                                                                                                                                                                                                                                             n/include/alertandautorenewssl.php
* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp
* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp
* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp
* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp

I do all step from tutorial copy paste..
Did i need to change "cwp" with my domain(www.domain.com)
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 12:56:02 PM
yes you need to change with the domain name you choose while installing awstats
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 12:58:48 PM
I use command perl tools/awstats_configure.pl again and add domain on line Your web site, virtual server or profile name: www.domain.com
But i still dont have updates.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:01:13 PM
what is output of
ls -lah /etc/awstats/
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:05:16 PM
total 140K
drwxr-xr-x   2 root root   66 Aug 31 15:51 .
drwxr-xr-x. 89 root root 8.0K Aug 30 16:36 ..
-rw-r--r--   1 root root  63K Aug 31 11:38 awstats.cwp.conf
-rw-r--r--   1 root root  63K Aug 31 15:51 awstats.www.salespc.net.conf
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:06:42 PM
What is output of

cat /etc/awstats/awstats.www.salespc.net.conf | grep LogFile
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:09:59 PM
# "LogFile" contains the web, ftp or mail server log file to analyze.
# Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log"
LogFile="/var/log/httpd/mylog.log"
PurgeLogFile=0
# When PurgeLogFile is setup to 1, AWStats will clean your log file after
# This parameter is not used if PurgeLogFile=0
# Possible values: 0, 1, or tags (See LogFile parameter) for suffix
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:11:21 PM
Run the commands below

Code: [Select]
sed -i 's|var/\log/\httpd/\mylog.log|usr\/local/apache/logs/access_log|g' /etc/awstats/awstats.www.salespc.net.conf
rm -rf /usr/local/apache/logs/access_log
service httpd restart
crontab -l | { cat; echo "* * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.salespc.net"; } | crontab -
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:16:48 PM
Its same when open http://localip/awstats/awstats.pl?month=04&year=2018&output=main&config=www.salespc.net&framename=index
No updates
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:20:39 PM
Well then what is output of

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.salespc.net
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:22:04 PM
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).
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:25:44 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:26:50 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:30:56 PM
output of

tail -f /usr/local/apache/logs/access_log
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:32:44 PM
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

Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:36:24 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 01:41:27 PM
Then cant work with ngix?Chance to work it or some alternative?
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:52:24 PM
I dont know if actually it is causing issue. I would suggest you to contact your server admin regarding it once.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 01:54:26 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 02:08:21 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 02:11:34 PM
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
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 02:16:30 PM
there is not that line in this file?
Did i need to add it?
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 02:18:04 PM
add the below command at the end of your httpd.conf file

CustomLog "logs/access_log" combined
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: jeniha on August 31, 2018, 02:21:17 PM
WORK!
Where was the problem actualy?
And 10x for you time and help.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: bullten on August 31, 2018, 02:23:40 PM
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.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: sundigital on December 23, 2018, 12:40:30 PM
I used this tutorial but I faced with a text plain output when try to see stats
beginning like this:

#!/usr/bin/perl
#------------------------------------------------------------------------------
# Free realtime web server logfile analyzer to show advanced web statistics.
# Works from command line or as a CGI. You must use this script as often as
# necessary from your scheduler to update your statistics and from command
# line or a browser to read report results.
# See AWStats documentation (in docs/ directory) for all setup instructions.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------
require 5.007;

#$|=1;
#use warnings;      # Must be used in test mode only. This reduce a little process speed
#use diagnostics;   # Must be used in test mode only. This reduce a lot of process speed
use strict;
no strict "refs";
use Time::Local
  ; # use Time::Local 'timelocal_nocheck' is faster but not supported by all Time::Local modules
use Socket;
use Encode;
use File::Spec;
 
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: s0c25 on January 18, 2019, 05:22:03 AM
Hola,

Te sale esa pantalla porque tienes que agregar el modulo al archivo de configuracion. en la ruta:

/usr/local/apache/conf.d/mod_cgid.conf

Agregas

LoadModule cgid_module modules/mod_cgid.so
<IfModule cgid_module>
<Directory /usr/local/awstats/wwwroot/cgi-bin/>
Options ExecCGI SymLinksifOwnerMatch
SetHandler cgi-script
AddHandler cgi-script .cgi .pl .py
Require all granted
AllowOverride All
</Directory>
</IfModule>

reinicias apache

Con eso deberia de abrir la interfaz.

Ahora tendras inconvenientes en actualizar las estadisticas. En si tendras que crear un directorio con permiso de lectura y escritura en la ruta donde este el usuario de dicho dominio que usara la metrica.

Ejemplo.

/home/alca/awstats

Dicho directorios con los permisos necesarios, sera utilizado para dejar el reporte de estadisticas, pero primero deberas editar
el archivo de configuracion de dicho sitio en la ruta:

/etc/awstats

ahi nano al archivo de configuracion de tu sitio. y buscas las lineas.

AllowToUpdateStatsFromBrowse de 0 le pones un 1, asi puedes actualizar desde el boton desde la interfaz.

Buscas en el mismo archivo la linea Dirdata y la editas con la nueva ruta de, por ejemplo:

#DirData="/var/lib/awstats"
DirData="/home/alca/awstats" "Yo lo tengo en esa ruta , pero deberia ser por default, en la ruta que tu deseeas el directorio debe tener los permisos de escritura y lectura"

Con eso ya deberias poder tener la estadisticas actualizada.

Saludos
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: netuser01 on February 16, 2019, 12:47:18 AM
Hi,

I received this error:

[root@p01 lib]# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=cwp
Error: Not same number of records of RobotsSearchIDOrder_listx (total is 1106 entries) and RobotsHashIDLib (1105 entries without 'unknown') in Robots database. Check your file /usr/local/awstats/wwwroot/cgi-bin/lib/robots.pm is up to date.
Setup ('/etc/awstats/awstats.cwp.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

Can someone help me?
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: evansa on February 18, 2019, 12:52:32 PM
Hello,

Please follow the link below
https://panel.bullten.net/knowledgebase/59/Install-and-Configure-Awstats-in-CWP.html
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: netuser01 on February 22, 2019, 04:58:40 PM
Hi,


Thank you!! with this tutorial worked.
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: tokar86a on February 24, 2019, 01:48:48 PM
Hi,


Thank you!! with this tutorial worked.

What tutorial did you use?
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: netuser01 on February 28, 2019, 01:21:20 PM
This tutorial

https://panel.bullten.net/knowledgebase/59/Install-and-Configure-Awstats-in-CWP.html
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: tokar86a on February 28, 2019, 08:31:55 PM
Nice sure going to try it out tomorrow :)
Title: Re: [Tutorial] integrating Awstats in Centos Web Panel
Post by: tokar86a on March 01, 2019, 10:26:57 AM
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):
104.231.41.24 - - [01/Mar/2019:11:23:27 +0100] "POST / HTTP/1.0" 204 -
Setup ('/etc/awstats/awstats.tt.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

I end up whit this error when i follow that guide.