In this tutorial, we will learn how to ignore or exclude specific IP addresses from our Awstats data. When set up, Awstats parses our server log files and generates detailed reports of user locations, IP addresses, referrers, and so on. Awstats can be used to give an excellent idea of where your visitors are coming from, how they got to your site, and what they are looking on once on your site.
Using this information will allow a webmaster to fine-tune aspects of his or her site for maximum user satisfaction.
Any webmaster will undoubtedly contribute somewhat to the traffic that his site receives. For modest personal sites, the traffic generated by the webmaster during updates and maintenance may skew the actual statistical data.
Awstats has a very handy feature which can be used to tell awstats to ignore a particular IP address. When configured properly, Awstats will accurately exclude an IP address or addresses when generating its statistics.
The configuration for ignoring an IP address is made in the awstats configuration file. This file, on the more popular versions of Linux, such as Ubuntu, is located at /etc/awstats/awstats.conf.
To open the awstats configuration file using nano text editor for example, using a terminal (as the superuser) type:
nano /etc/awstats/awstats.conf
Look for the line which says:
SkipHosts=""
and change it (for example) to:
SkipHosts="REGEX[^123\.456\.]"
The regular expression ^123\.456\. will match all IP addresses of the form 123.456.xxx.xxx and is useful when you know the block of IP addresses that your ISP uses.
If the public IP address of your internet connection at one time is 58.34.89.35 and then another time is 58.34.92.108, you may assume that your ISP uses a block of 58.34.*.* and your would configure Awstats to ignore your visits by using:
SkipHosts="REGEX[^58\.34\.]"
This is a very simplified example and a small website may get away using this configuration. For larger websites, it may be impractical to be so general in the exclusion of websites, and greater care would have to be taken when writing the regular expression to match.
We hope this Awstats tutorial was helpful. Please comment on it, rate it, or share it using the facilities below if you found it useful.