Awstats

AWStats is a free powerful and featureful server logfile analyzer that shows you all your Web/Mail/FTP statistics including visits, unique visitors, pages, hits, rush hours, os, browsers, search engines, keywords, robots visits, broken links and more...

The Webalizer is a web server log file analysis program which produces usage statistics in HTML format for viewing with a browser.

(1)awstats
/scripts/runweblogs

(2)webalizer
/usr/local/cpanel/3rdparty/bin/english/webalizer -N 10 -D /home/username/tmp/webalizer/dns_cache.db -R 250 -p -n domain.com -o /home/username/tmp/webalizer /usr/local/apache/domlogs/domain.com
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
cp -pr /home/user/tmp/webalizer /home/user/tmp/webalizer.bkp
/scripts/fixwebalizer username
vi /home/user/tmp/webalizer.bkp/webalizer.hist
copy the line from this file and add this to the appropriate line in the new file /home/user/tmp/webalizer/webalizer.hist
/scripts/runweblogs username

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Got error db_put fail! while running the above command

DNS Lookup (10): Error: Unable to open DNS cache file /home/cgregori/tmp/webalizer/dns_cache.db
solution

db_put fail! is caused by a corrupt dns_cache.db file.

Delete that file and it will be regenerated on the next stats run.
/home/user//tmp/webalizer/dns_cache.db

repair the database eximstats through whm
========================
(3)The script is used for deleting stats of previous months
/scripts/fixwebalizer
http://forums.cpanel.net/showthread.php?t=18143&highlight=run+statistics (caution)
(4)common methods
1. Modifying the variable extracpus in /var/cpanel/cpanel.config to 10

2. Running /scripts/fixwebalizer {username} (caution)

3. Restarting CPANEL /etc/rc.d/init.d/cpanel restart

4. Running /scripts/runweblogs {username}

5. Running /scripts/runlogsnow

6. /usr/local/apache/domlogs/domainname logs for apache hits

7. myisamchk -r /var/lib/mysql/eximstats/smtp.MYI used when error, mainly mysql error, occurs while running /scripts/runweblog

8. bandwidth not updated in server wide
save the script in a file and execute it.

 

 

 

weblogs
Don't forget to kill cpanellogd before running this
cd /var/cpanel/users;for i in *;do /scripts/runweblogs $i;echo logs done for $i;done;echo &all done&

 

#!/bin/bash
for name in `ls /home`
do
/usr/local/cpanel/cpanellogd $name 2>&1 /dev/null
done

 

root# cd /var/cpanel/users
root# for i in * ; do /scripts/runweblogs $i ; done

 

 

 

 

before doing this kill cpanellogd
#!/bin/bash
for name in `ls /home`
do
/usr/local/cpanel/cpanellogd $name 2>&1 /dev/null
done

 

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
put the following script in a file and run itas script

#!/bin/bash

cat /etc/trueuserdomains | cut -d: -f 2 > /root/users_logs;
for i in `cat /root/users_logs`; do
/scripts/runweblogs $i;
sleep 10s;
done;

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7

 

Is it possible to allow users to update Awstats from the Cpanel?

Yes, Change the parameter "AllowToUpdateStatsFromBrowser" in /usr/local/cpanel/etc/awstats.conf set to 1, AWStats add a button on report page to "update" statistics from a web browser. This is not a good idea, because Update process can be long so you might experience "time out" browser errors if you don't launch AWStats enough frequently. Also, it take around 12-24 hours to take into effect.
There is an option in WHM>> Server Configuration >> Tweak Settings>>Stats and Logs to "Allow users to update Awstats from cPanel".

How to updae Awstats and webalizer via shell?
We could update the webalizer using the command /usr/local/cpanel/3rdparty/bin/english/webalizer -N 10 -D /home/username/tmp/webalizer/dns_cache.db -R 250 -p -n domain.com -o /home/username/tmp/webalizer /usr/local/apache/domlogs/domain.com

The Awstats can be updated by using the script /scripts/runweblogs accountname

Is it possible to view webalizer stats without login to cpanel?

Yes. Do the following steps.
cd /home/username/www
ln -s ../tmp/webalizer stats
chown username.username stats
cd ../tmp
chmod 755 ./
chmod 755 ./webalizer
---------------- will allow domain.com/stats/ for viewing stats without logging in to cpanel

How to access Awstats From Outside the control panel

Accessing Awstats from outside the control panel is easy.
Step 1.
Download awstats from http://awstats.sourceforge.net
Step 2.
Uncompress awstats-5.6.tgz
Step 3.
Copy the contents of the uncompressed cgi-bin folder from your hard drive to the user cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).
Step 4.
If necessary (should not be needed with most setups), edit the first (top-most) line of awstats.pl file that is
#!/usr/bin/perl
to reflect the path were your Perl interpreter is installed. Default value works for most of Unix OS, but it also might be #!/usr/local/bin/perl
Step 5.
Move AWStats icon sub-directories and its content into a directory readable by your web server, for example /home/users/public_html/icons
Step 6.
Copy awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. This new file must be stored in /home/user/public_html/cgi-bin.
Step 7.
Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file (The path is: LogFile="/usr/local/apache/domlogs/domain.com").
- Check if LogFormat has the value "1" (it means "NCSA apache combined/ELF/XLF log format").
- Change DirIcons parameter to reflect relative path of icon directory. (DirIcons="/icons")
- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).
IMPORTANT!
- Change DirData to use the same Statics file than Cpanel Awstats and do not loose any entry.
(DirData="/home/user/tmp/awstats/")
Step 8.
Access AwStats by the URL:
www.domain.com/cgi-bin/awstats.pl?config=domain.com
That's all!!!
The AwStats will refresh the Statics every 24 Hours.