UnixServerAdmin

Server Administration & Management

How to ignore some files/folders from awstats reports in cPanel

Awstats will consider as a page hit any entry from the log it processes. By default some file extensions (for regular image types and css/js) are excluded from what awstats will consider as a page:

NotPageList=”css js class gif jpg jpeg png bmp ico”(this is the default). All other file types will be counted as pages. Now, if we want to completely ignore some files, or even all the content of one folder from the awstats processing we can use the SkipFiles parameter. We might want to do this to ignore some frames, hidden pages, ajax calls, etc.

The SkipFiles parameter is by default empty, and in order to use it we have to add the appropriate config in our awstats.conf file.  For example to ignore a file called somefile.php we will add “/somefile.php“:
SkipFiles=”/somefile.php”
while if we want to ignore all the pages in a folder called somefolder we will have to use a regex value like: “REGEX[^\/somefolder]“
We can add several rules separated by spaces:
SkipFiles=”/somefile.php REGEX[^\/somefolder]”

Note: this will be effective only for new updates; meaning existing data will not be affected by this (if really needed you will have to regenerate your stats to get rid of those pages in old stats).

Advertisements

July 26, 2012 Posted by | cPanel | , , | Leave a comment

How to configure Webalizer

The Webalizer is a GPL application that generates web pages of analysis, from access and usage logs, i.e. it is web log analysis software. It is one of the most commonly used web server administration tools. It was initiated by Bradford L. Barrett in 1997. Statistics commonly reported by Webalizer include: hits; visits;  referrers; the visitors’ countries; and the amount of data downloaded. These statistics can be viewed graphically
and presented by different time frames, such as per day, hour, or month.

Hit

Each HTTP request submitted by the browser is counted as one hit. Note that HTTP requests may be submitted for non-existent content, in which case they still will be counted. For example, if one of the five image files referred by the example page mentioned above is missing,
the web server will still count six HTTP requests, but in this case, five will be marked as successful (one HTML file and four images) and one as a failed request (the missing image)

Here is steps to configure webalizer

1) Install the webalizer by yum

# yum install webalizer

2) vim /etc/httpd/conf.d/webalizer.conf

=====================================
Alias /usage /var/www/usage

#<Location /usage>
#       AllowOverride AuthConfig
#       Order allow,deny
#       Allow from all
#</Location>

<Directory “/var/www/usage”>
    AllowOverride AuthConfig
   Options Indexes FollowSymLinks Includes
    Order allow,deny
    Allow from all
</Directory>
=====================================

3. Create .htacess file

# vim /var/www/usage/.htaccess

=====================================
AuthUserFile /etc/httpd/htpasswd
AuthName “Please provide Login Credentials”
AuthType Basic
require valid-user
=====================================

4. Restart httpd services.

# /etc/init.d/httpd restart

February 14, 2012 Posted by | Apache, Tips & Tricks, Unix/Linux | , , , , , | 7 Comments

How to update awstats from shell for all users in cPanel

Refer following command to update awstats for all users on your cPanel linux server but make sure that you are logged in as root user.

# cat /etc/trueuserowners | sort | cut -f 1 -d : | awk ‘{print “/scripts/runweblogs “$1}

December 4, 2011 Posted by | cPanel | , , | Leave a comment

Awstats “update now” button shows blank page and cpanel error log shows “Out of Memory”

The cPanel error logs shows Out of Memory! when you click the “update now” button in Awstats. This usually happens when cPanel’s php is set with low memory. But in most of the cases this is not the issue.

Go to WHM –> Tweak Settings –> “The maximum memory a cPanel process can use before it is killed off (in megabytes). Values less than 128 megabytes can not be specified. A value of “0? will disable the memory limits.”

Set this to 0 or a higher value..

In the Awstats case, the cPanel processes memory is getting exhausted.

This can be done also by editing the file

# vi /var/cpanel/cpanel.config

maxmem=0

# /usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

 

July 3, 2011 Posted by | cPanel | , | Leave a comment

How to Install & enable Awstats outside cPanel

Follow the steps below to access the awstats outside the cPanel

Step 1. Download awstats

# cd /home/username/public_html
# wget http://prdownloads.sourceforge.net/awstats/awstats-6.9.tar.gz

Step 2. Uncompress  awstats-5.6.tgz

# tar -zxvf awstats-6.9.tar.gz

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).

# cp -af awstats-6.9/wwwroot/cgi-bin .

Step 4. If necessary (should not be needed with most setups), edit the first (top-most) line of awstats.pl file that

=================================
#!/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
=================================

# which perl
# vi cgi-bin/awstats.pl

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

# cp -af awstats-6.9/wwwroot/icon

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

# cp -af cgi-bin/awstats.model.conf cgi-bin/awstats.domain.conf

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=”/home/username/public_html/icons”)

– Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: http://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 :-

http://www.domain.com/cgi-bin/awstats.pl?config=domain.com

That’s all!!! The AwStats will refresh the Statics every 24 Hours.

April 10, 2011 Posted by | cPanel | , | 7 Comments

How to enable AWStats updating from cPanel

How to enable AWStats updating from cPanel

Sometimes, it may be easier to just enable your cPanel user accounts to update manually.

Login to WHM, then select Server Configuration -> Tweak Settings.
Scroll down to Stats and Logs.
Check the box “Allow users to update Awstats from cPanel”

Sometimes, it happens that Awstats are not getting updated for a domain in cPanel.
In such cases, it is better idea to put up “Update now” button for user to update Awstats on demand.

You can perform this by following below steps:

1. Login to your server via SSH as root
2. cd /home/username/tmp/awstats/
3. Edit awstats config file of domain. For example awstats.domain.com.conf using following command:

vi awstats.domain.com.conf

4. Search for ”AllowToUpdateStatsFromBrowser”.
5. Assign the value “1” as shown below:

AllowToUpdateStatsFromBrowser= 1

6. Save the file and exit.

Just refresh the statistics page and you will see “update now” button on the top of the page.

January 2, 2011 Posted by | cPanel | , , | 1 Comment