awstats install 文件夹
# cd /opt
# wget http://www.awstats.org/files/awstats.tar.gz
# tar xvf awstats.tar.gz
# mv awstats/usr/local/awstats
2、创建一个tomcot统计
[root@portal-1 tools]cd /user/local/awstats/tools
[root@portal-1 tools]# perl awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.9) (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 //tomcat 设置为空
Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)
-----> 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
-----> 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.ejoywifi.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):
>
-----> Create config file '/etc/awstats/awstats.www.ejoywifi.com.conf'
Config file /etc/awstats/awstats.www.ejoywifi.com.conf created.
-----> 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.ejoywifi.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.ejoywifi.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.ejoywifi.com' with command:
> perl awstats.pl -update -config=www.ejoywifi.com
You can also build static report pages for 'www.ejoywifi.com' with command:
> perl awstats.pl -output=pagetype -config=www.ejoywifi.com
Press ENTER to finish…
awstats logformat:
# %host Client hostname or IP address (or Sender host for mail log)
# %host_r Receiver hostname or IP address (for mail log)
# %lognamequot Authenticated login/user with format: "john"
# %logname Authenticated login/user with format: john
# %time1 Date and time with format: [dd/mon/yyyy:hh:mm:ss +0000] or [dd/mon/yyyy:hh:mm:ss]
# %time2 Date and time with format: yyyy-mm-dd hh:mm:ss
# %time3 Date and time with format: Mon dd hh:mm:ss or Mon dd hh:mm:ss yyyy
# %time4 Date and time with unix timestamp format: dddddddddd
# %methodurl Method and URL with format: "GET /index.html HTTP/x.x"
# %methodurlnoprot Method and URL with format: "GET /index.html"
# %method Method with format: GET
# %url URL only with format: /index.html
# %query Query string (used by URLWithQuery option)
# %code Return code status (with format for web log: 999)
# %bytesd Size of document in bytes
# %refererquot Referer page with format: "http://from.com/from.htm"
# %referer Referer page with format: http://from.com/from.htm
# %uabracket User agent with format: [Mozilla/4.0 (compatible, ...)]
# %uaquot User agent with format: "Mozilla/4.0 (compatible, ...)"
# %ua User agent with format: Mozilla/4.0_(compatible...)
# %gzipin mod_gzip compression input bytes: In:XXX
# %gzipout mod_gzip compression output bytes & ratio: Out:YYY:ZZpct.
# %gzipratio mod_gzip compression ratio: ZZpct.
# %deflateratio mod_deflate compression ratio with format: (ZZ)
# %email EMail sender (for mail log)
# %email_r EMail receiver (for mail log)
# %virtualname Web sever virtual hostname. Use this tag when same log
# contains data of several virtual web servers. AWStats
# will discard records not in SiteDomain nor HostAliases
# %cluster If log file is provided from several computers (merged by
# logresolvemerge.pl), use this to define cluster id field.
# %extraX Another field that you plan to use for building a
# personalized report with ExtraSection feature (See later).
# If your log format has some fields not included in this list, use:
# %other Means another not used field
# %otherquot Means another not used double quoted field
5、测试执行读取日志更新
[root@portal-1 cgi-bin]# perl awstats.pl -update -config=www.ejoywifi.com
Error: AWStats database directory defined in config file by 'DirData' parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/awstats.www.ejoywifi.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
#用来存放awstats的数据文件
[root@portal-1 /]# mkdir -m 755 /var/lib/awstats
手动生成awstats日志分析数据库信息
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.ejoywifi.com
[root@portal-1 conf]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.ejoywifi.com
Create/Update database for config "/etc/awstats/awstats.www.ejoywifi.com.conf" by AWStats version 7.0 (build 1.975)
From data in log file "/data/portalCms/web/tomcat7_web/logs/web_access_log.2015-10-13.txt"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 1202)
Jumped lines in file: 1202
Found 1202 already parsed records.
Parsed lines in file: 4
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 4 new qualified records.
13. a. 在/webapps/下创建 awstats目录以及相应的WEB-INF目录
b. 将user/local/awststs/wwwroot/目录下 css/,icon/,js/目录拷贝到 /webapps/awstats/ 目录下
c. 将user/local/awststs/wwwroot/cgi-bin/ 下的所有文件拷贝到 /webapps/awstats/WEB-INF/cgi 目录下