In the HTTPD server's access log file Access_log, a large number of client access information is logged, and by analyzing this information, you can understand the Web site's access, such as the number of access IP per day or a specific time period, the most-clicked page.
This article describes how to install the Awstats log Analysis system to automate log analysis and statistical work.
Experimental environment;
1) VMware Workstation virtual machine environment
2) redhat6.5 series hosts for Linux systems, providing Web services, deploying Awstats
Before deploying Awstats, set up the Web site www.benet.com in advance on the host of the redhat6.5 system, with the following steps:
Modify the httpd Master profile/etc/httpd/conf/httpd.conf
Listen? 192.168.30.15:80?????????? #监听地址改为本机ip, Port 80
ServerName www.benet.com:80???? #设置web站点的完整主机名
?
Start the httpd service
?
Then use the RPM command to install the BIND software package, set up the DNS service, provide the site www.benet.com domain name resolution service. The concrete steps are as follows;
Modify the configuration file/etc/named.conf, respectively,/etc/named.rfc1912.zones
?
?
?
?
Switch to the/var/named directory, copy the database file template, and specify the domain name resolution record.
?
?
Use the service command to start services. Service named start
?
1, deploy Awstats analysis system
Awstats software package can be downloaded from the official website http://www.awstats.org/, the following awstats-7.6.tar.gz package as an example of the Web site www.benet.com add awstats log Analysis System process
(1) Installing the Awstats package
Unzip the pre-prepared package into the/OPT directory and cut it to the/usr/local/directory and rename it to Awstats
?
?
?
(2) Create a profile for the site to be counted
simplifies the creation process with the help of awstats_configure.pl scripts provided by the Awstats system
First switch to the/usr/local/awstats/tools directory and execute the awstats_configure.pl script in it
?
After entering an interactive configuration process, check the Awstats installation directory, httpd the configuration file path of the service, logging format and other system environment, and prompt the user to specify the site name, set the configuration file path.
1) Specify the path to the httpd master configuration file
The configuration script will find and identify the main profile of the HTTPD service in order to automatically add related configuration content and manually enter the path to the httpd.conf profile
?
?
2) Create a profile for the specified Web site
Follow the prompts to continue selecting "Y" to create a site profile and specify the target site name to be counted (manually enter the station name Www.benet.com), where the site configuration file will be stored (default is/etc/awstats)
?
?
A URL path is generated during the configuration process; http://localhost/awstats/awstats.pl?config= Www.benet.com, you can use this address later to access the Log Analysis page, note that when you visit to the www.benet.com or the corresponding IP address
?
?
?
You can also set the Cycle Schedule task cron and update the log periodically as prompted
Next we want to look at httpd in the main configuration file to write Awstats related content, you can see at the end of the configuration file more than a few awstats configuration items
?
3) Modify the site statistics configuration file
After setting up the configuration file for the site www.benet.com, further modifications are needed, including the Web log files to be analyzed and the directories used to hold the statistics.
First switch to the storage directory of the new site statistics Profile/etc/awstats/, and look at the path location of the httpd access log file.
?
?
?
Modifies the configuration file, where logfile is used to specify the log path, the actual location of the Web log file should be set, and dirdate is used to specify the data directory, which can take the default value, but the specified directory (/var/lib/awstats) needs to be created.
?
?
4) access to the Awstats analysis system
In the browser input address http://www.benet.com/awstats/awstats.pl?config=www.benet.com, you can see the Awstats Log Analysis System statistics page. This page lists various detailed website visits according to the access time, user source, browser and other types.
?
?
?
5) using the awstats_updateall.pl script provided by the Awstats system, you can update the log statistics for all sites, and when the script is executed, the new log content is automatically parsed and the analysis results updated to the statistics database.
?
You can also set cron scheduled tasks so that the system periodically updates the log statistics.
?
You can see the data after the update.
?
?
6) Permission control for Awstats Analysis System page Access can be achieved through the Order,allow From,deny from configuration of the httpd service. Set the blacklist to prohibit the host access of the 192.168.30.0 network segment as follows.
?
?
7) In order to simplify the operation, you can create an automatic jump HTML page in the Web root directory, for example, after performing the following actions, users will automatically jump to the Awstats log Analysis page of the www.benet.com site as long as they access http://www.benet.com/awb.html.
?
?
Awstats log analysis of Web site access provided by Apache