In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
AWStats presentation
AWStats is an open source log analysis system developed using Perl language. It can be used not only to analyze Apache web server access logs, but also to analyze log information of Samba, Vsftpd, IIS and other services. Combined with scheduled task services such as crond, growing log content can be analyzed periodically.
AWStats requires PERL environment support to run. From AWStats documentation, it supports Apache HTTP Server perfectly, and when we use Nginx server, it becomes very troublesome to run AWStats. First of all, Nginx itself has weak support for Perl, and even the official does not recommend using it. In addition, the log format needs to be modified to run smoothly.
Here is how to generate static pages by making AWStats count the results of nginx server logs, and then access the logs through the Nginx site.
Environment:
CentOS 7 operating system
Server IP address: 192.168.40.15
AWStats-7.6.tar.gz Baidu net disk password: auwy
Nginx server has been deployed (log directory: /user/local/nginx/logs/access. log)
DNS forward resolution has been completed, and the server can be accessed normally through www.test.com (please refer to:DNS domain name resolution service (forward resolution, reverse resolution, master-slave server) Part 1 Forward resolution)
Purpose:
Add AWStates log analysis system to Nginx site www.test.com
Deployment Services:
Before installing AWStates, make sure the Perl environment is installed on the server
perl -version
1. Unzip and install AWStates software package (can be downloaded to my Baidu cloud disk)
#Extract awstats package to/usr/local/
tar zxvf awstats-7.6.tar.gz -C /usr/local/
#rename awstats
mv /usr/local/awstats-7.6 /usr/local/awstats
#change awstats to belong to main group
chown root.root -R /usr/local/awstats
#Go to tools directory cd /usr/local/awstats/tools/
2. Create a new site statistics configuration file for www.test.com, using the awstats_configure.pl script provided by AWStates system, as follows:
./ awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
You are not an administrator user,
You want to analyze downloaded log files without web server,
You want to analyze mail or ftp log files instead of web log files,
You need to analyze load balanced servers log files,
You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
none #nginx server, enter 'none' Skip
-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
Add '' directive
AWStats directives added to Apache config file.
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y #Enter y to create a new statistical configuration
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
www.test.com #Domain name entered for statistics:www.test.com
-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
#Direct "Enter"
-----> Create config file '/etc/awstats/awstats.www.test.com.conf'
Config file /etc/awstats/awstats.www.test.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /etc/awstats/awstats.www.test.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.test.com' with command:
perl awstats.pl -update -config=www.test.com
You can also read your statistics for 'www.test.com' with URL:
http://localhost/awstats/awstats.pl? config=www.test.com
Press ENTER to finish... #Direct "Enter" Exit
3. Modify www.test.com statistics profile
vim /etc/awstats/awstats.www.test.com.conf
......
LogFile="/usr/local/nginx/logs/access.log" Line #50, modify the nginx log file location
DirData="/var/lib/awstats" #220 line, data directory, awstats directory does not exist by default (need to create)
......
Create/var/lib/awstats directory
mkdir -p /var/lib/awstats
4. Update analysis log file
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com
5. Generate static analysis log web data
/usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config=www.test.com -lang=cn -dir=/usr/local/awstats/wwwroot -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl
The above order is interpreted as follows:
/usr/local/awstats/tools/awstats_buildstaticpages.pl: awstats static page generation tool
- update -config= www.test.com: update configuration domain name
-lang=cn: Language is Chinese
dir=/usr/local/awstats/wwwroot: Directory of statistics output
awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl Path to log updater
6. Set up timed tasks for Awstats to update automatically (23:59 daily)
vim /etc/crontab
59 23 * root /usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config=www.test.com -lang=cn -dir=/usr/local/awstats/wwwroot -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl
Or as shown below:
Start crond service
systemctl start crond.service
7. Create awstats virtual directory in HTML of nginx
The requested URL/usr/local/nginx/html was not found on this server.
The requested URL/usr/local/awstats/wwwroot/wstats.html was not found on this server.
8. Create a configuration file for the awstats virtual directory in nginx, without affecting normal ip access
vi /usr/local/nginx/conf/nginx.conf
server {
listen 80 ;
server_name localhost; Note: localhost here can be modified to local ip
location /awstats {
root html;
index index.html awstats.www.test.com.html;
}
}
As shown in the picture
9. restart nginx
Nginx -t
Systemctl restart nginx
10. test
Visit AWStats log analysis system URL: 192.168.40.15/awstats
normal ip address access
Visit with the domain name www.test.com
That's the whole experiment.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.