In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Experimental process of AWstats Log Analysis for Apache configuration and Application
Experimental environment: centos7 operating system, a win10 virtual machine operating system, software packages are required:
Bind.x86_64 32 yum 9.11.4-9.P2.el7 httpd.x86_64 0 yum 2.4.6-90.el7.centos (installed directly here for ease of use)
Awstats-7.6.tar.gz (need to prepare yourself, link: https://pan.baidu.com/s/1apCEUdFoAoUTVeWwYyJaow
Extraction code: wt6u)
The specific operation procedure is as follows:
1) decompress awstats software package
Tar zxvf awstats-7.6.tar.gz-C / usr/local
Ls / usr/local/
2) install bind and httpd service configuration bind related files
Yum install-y bind httpd
[root@localhost tools] # vim / etc/named.conf [root@localhost tools] # head-21 / etc/named.conf | tail options {listen-on port 53 {any;}; listen-on-v6 port 53 {:: 1;}; directory "/ var/named"; dump-file "/ var/named/data/cache_dump.db"; statistics-file "/ var/named/data/named_stats.txt" Memstatistics-file "/ var/named/data/named_mem_stats.txt"; recursing-file "/ var/named/data/named.recursing"; secroots-file "/ var/named/data/named.secroots"; allow-query {any;} [root@localhost tools] # vim / etc/named.rfc1912.zones [root@localhost tools] # head-29 / etc/named.rfc1912.zones | tail-5zone "lcc.com" IN {type master; file "lcc.com.zone"; allow-update {none;};} [root@localhost tools] # cd / var/named/ [root@localhost named] # lsdata dynamic named.ca named.empty named.localhost named.loopback slaves [root@localhost named] # cp-p named.localhost lcc.com.zone [root@localhost named] # vim lcc.com.zone [root@localhost named] # cat lcc.com.zone $TTL 1D @ IN SOA @ rname.invalid. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS @ A 127.0.0.1www IN A 192.168.68.145 [root@localhost named] # systemctl stop firewalld.service [root@localhost named] # setenforce 0 [root@localhost named] # systemctl start named [root@localhost named] # systemctl start httpd [root@localhost named] # netstat-antp | grep httpdtcp6 0: 80:: * LISTEN 88534/httpd [root@localhost named] # netstat-antp | grep namedtcp 0 192.168.68.145 grep namedtcp 53 0.0.0.0 LISTEN 88258/named tcp 0 0127.0.1 netstat 53 0.0.0.0 * LISTEN 88258/named Tcp 0 0 127.0.1 LISTEN 88258/named tcp6 953 0.0.0.0 * LISTEN 88258/named tcp6 0 0:: 1:53:: * LISTEN 88258/named tcp6 0 0:: 1 LISTEN 88258/named
Test whether the domain name just set can be resolved successfully on the virtual machine of win10.
3) create a profile for the site to be counted
Specify the path to the httpd main configuration file-- "set log type--" create a profile for the specified web site
[root@localhost tar] # cd / usr/local/awstats-7.6/tools/ [root@localhost tools] # lsawstats_buildstaticpages.pl logresolvemerge.plawstats_configure.pl maillogconvert.plawstats_exportlib.pl nginxawstats_updateall.pl urlaliasbuilder.pldolibarr webmingeoip_generator.pl xslthttpd_ confession [root @ localhost tools] #. / awstats_configure.pl-AWStats awstats_configure 1.0 (build 20140126 (C) Laurent Destailleur-This tool will help you to configure AWStats to analyze statistics forone web server. You can try to use it to let it do all that is possiblein AWStats setup, however following the step by step manual setupdocumentation (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 UnixWarning: AWStats standard directory on Linux OS is' / usr/local/awstats'.If you want to use standard directory You should first move all contentof AWStats distribution from current directory:/usr/local/awstats-7.6to standard directory:/usr/local/awstatsAnd then, run configure.pl from this location.Do you want to continue setup from this NON standard directory [yN]? Y / / enter y-> Check for web server installEnter full config file path of your Web server.Example: / etc/httpd/httpd.confExample: / usr/local/apache2/conf/httpd.confExample: C:\ Program files\ apache group\ apache\ conf\ httpd.confConfig file path ('none' to skip web server setup): > path to the main configuration file of / etc/httpd/conf/httpd.conf / / HTTPd-> Check and complete web server config File'/ etc/httpd/conf/httpd.conf' All AWStats directives are already present.- > Update model config file'/ usr/local/awstats-7.6/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/profilefile (required if first install) [y Unip N]? Y / / enter y-> Define config file name to createWhat is the name of your web site or profile analysis? Example: www.mysite.comExample: demoYour web site Virtual server or profile name: > www.lcc.com / / Domain name set by yourself-> Define config file pathIn which directory do you plan to store your config file (s)? Default: / etc/awstatsDirectory path to store config file (s) (Enter for default): > / / enter by default-> Create config file'/ etc/awstats/awstats.www.lcc.com.conf' Config file / etc/awstats/awstats.www.lcc.com.conf created.- > Add update process inside a schedulerSorry Configure.pl does not support automatic add to cron yet.You can do it manually by adding the following command to your cron: / / two ways to perform log analysis / usr/local/awstats-7.6/wwwroot/cgi-bin/awstats.pl-update-config=www.lcc.comOr if you have several config files and prefer having only one command:/usr/local/awstats-7.6/tools/awstats_updateall.pl now / / will report an error The solution is Press ENTER to continue... at the end of the article. A SIMPLE config file has been created: / etc/awstats/awstats.www.lcc.com.confYou should have a look inside to check and change manually main parameters.You can then manually update your statistics for 'www.lcc.com' with command: > perl awstats.pl-update-config=www.lcc.comYou can also read your statistics for' www.lcc.com' with URL: > http://localhost/awstats/awstats.pl?config=www.lcc.com / / this is the address we want to test Need to replace localhost with www.lcc.comPress ENTER to finish... [root@localhost tools] # systemctl restart httpd
4) modify the awstats access permissions automatically generated by Apache version 2.4 or above
[root@localhost tools] # vim / etc/httpd/conf/httpd.conf [root@localhost tools] # tail / etc/httpd/conf/httpd.conf # This is to permit URL access to scripts/files in AWStats directory.# Options None AllowOverride None # Order allow,deny / / comment out # Allow from all / / comment out Require all granted / / add (all permissions)
5) modify site statistics configuration file
[root@localhost tools] # vim / etc/awstats/awstats.www.lcc.com.conf [root@localhost tools] # head-50 / etc/awstats/awstats.www.lcc.com.conf | tail-1LogFile = "/ var/log/httpd/access_log" [root@localhost tools] # head-220 / etc/awstats/awstats.www.lcc.com.conf | tail-1DirData= "/ var/lib/awstats" [root@localhost tools] # cd / var/lib/ / / create the folder awstats [root@localhost lib] # mkdir awstats in the above path
6) perform log analysis
/ / the method for performing log analysis is given in the third step above, and it is also convenient to manage logs / / each time the command is executed by performing periodic scheduled tasks Refresh the visit page and display the relevant data [root@localhost tools] # / usr/local/awstats-7.6/wwwroot/cgi-bin/awstats.pl-update-config=www.lcc.comCreate/Update database for config "/ etc/awstats/awstats.www.lcc.com.conf" by AWStats version 7.6 (build 20161204) From data in log file "/ var/log/httpd/access_log"... Phase 1: First bypass old records Searching new record...Searching new records from beginning of log file...Jumped lines in file: 0Parsed lines in file: 0 Found 0 dropped records, Found 0 comments, Found 0 blank records, Found 0 corrupted records, Found 0 old records, Found 0 new qualified records.
For ease of management, we can use periodic task schedules to manage execution. If you are interested, you can use the crontab-e command to create periodic task schedules.
Summary
The purpose of this experiment is to use awstats for log analysis. The process is not complicated, but what we need to pay attention to, I have made some comments.
Of course, there are two problems with the experiment. Let's talk about it in detail here.
1. Using http://www.lcc.com/awstats/awstats.pl?config=www.lcc.com for access is not easy to remember, everything needs to be optimized.
[root@localhost html] # cd / usr/local/awstats-7.6/tools/ [root@localhost tools] # cd-/ var/www/html [root@localhost html] # vim aws.html [root@localhost html] # cat aws.html
After this setting, you can use http://www.lcc.com/aws.html to access it.
two。 When you use the second method to execute the log analysis command, you will encounter the following error
[root@localhost tools] # / usr/local/awstats-7.6/tools/awstats_updateall.pl now
Error: Can't find AWStats program ('awstats.pl').
Use-awstatsprog option to solve this.
The reason for this is that the absolute path to awstats.pl is not specified, just do the following
[root@localhost tools] # find / usr/local/-name awstats.pl/usr/local/awstats-7.6/wwwroot/cgi-bin/awstats.pl [root@localhost tools] # cd.. / wwwroot/cgi-bin/ [root@localhost cgi-bin] # lsawdownloadcsv.pl awredir.pl awstats.model.conf awstats.pl lang lib plugins [root@localhost tools] # / usr/local/awstats-7.6/tools/awstats_updateall.pl now-awstatsprog= ".. / wwwroot/cgi-bin / awstats.pl "Running'".. / wwwroot/cgi-bin/awstats.pl "- update-config=www.lcc.com-configdir=" / etc/awstats "'to update config www.lcc.comCreate/Update database for config" / etc/awstats/awstats.www.lcc.com.conf "by AWStats version 7.6 (build 20161204) From data in log file" / var/log/httpd/access_log "... Phase 1: First bypass old records Searching new record...Direct access after last parsed record (after line 101) Jumped lines in file: 101Found 101already parsed records.Parsed lines in file: 236 Found 0 dropped records, Found 0 comments, Found 0 blank records, Found 2 corrupted records, Found 0 old records, Found 234 new qualified records.
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.