Current Path : /home/tools/awstats/docs/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/tools/awstats/docs/awstats_setup.html |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta name="description" content="AWStats Documentation - Setup page"> <meta name="keywords" content="awstats, awstat, setup, config, install"> <meta name="robots" content="index,follow"> <meta name="title" content="AWStats Documentation - Setup page"> <title>AWStats Documentation - Setup page</title> <link rel="stylesheet" href="styles.css" type="text/css"> <!-- $Revision: 1.47 $ - $Author: eldy $ - $Date: 2003/09/22 04:01:59 $ --> </head> <body topmargin=10 leftmargin=5> <table style="font: 10pt arial,helvetica,verdana" cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF width=100%> <!-- Large --> <tr style="font: 10pt arial,helvetica,verdana"> <td bgcolor=#9999cc align=center><a href="/"><img src="images/awstats_logo4.png" border=0></a></td> <td bgcolor=#9999cc align=center> <br> <font style="font: 16pt arial,helvetica,sanserif" color=#EEEEFF><b>AWStats logfile analyzer 5.9 Documentation</b></font><br> <br> </td> <td bgcolor=#9999cc align=center> </td> </tr> </table> <br><br><H1 style="font: 26px arial,helvetica,sanserif">Install, Setup and Use AWStats</H1> AWStats common use is made in 3 steps:<br> <ul> <li>Step 1 : The install and setup<br> <li>Step 2 : The build/update of statistics<br> <li>Step 3 : The reading of results<br> </ul> <br> <br><a name="INSTALL"><H2 style="font: 22px arial,helvetica,sanserif color: #606060"><u>Step 1 : Install and Setup</u></H2></a> <br> <b>A) With Apache or compatible server (on Unix/Linux, Windows, MacOS...)</b><br> <br> * Step 1-1<br> Configure your apache web server to have <b>NCSA combined/XLF/ELF</b> log format (you can use your own log format but this predefined logformat is often the best choice and make setup easier). You can do this by changing, in <b>httpd.conf</b>, following directives (See your apache manual for more information):<br> <i>CustomLog /yourlogpath/yourlogfile common</i><br> into<br> <i>CustomLog /yourlogpath/yourlogfile combined</i><br> <br> To be sure the log format change is effective, you can stop Apache, remove all old log files, restart Apache and go to your homepage. This is an example of records you should get then in your new log file:<br> <i>62.161.78.75 - - [dd/mmm/yyyy:hh:mm:ss +0000] "GET / HTTP/1.1" 200 1234 "http://www.from.com/from.html" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"</i><br> <br> * Step 1-2<br> Copy the contents of the uncompressed cgi-bin folder from your hard drive to your server's cgi-bin directory (this includes <b>awstats.pl</b>, <b>awstats.model.conf</b>, and the <b>lang</b>, <b>lib</b> and <b>plugins</b> sub-directories).<br> <br> * Step 1-3<br> If necessary (should not with most Perl interpreter), edit the first (top-most) line of awstats.pl file that is<br> <i>#!/usr/bin/perl</i><br> to reflect the path were your Perl interpreter is installed. Default value works for most of Unix OS, but it also might be<br> <i>#!/usr/local/bin/perl</i><br> With Apache for Windows and ActivePerl interpreter, it might be<br> <i>#!c:/program files/activeperl/bin/perl</i><br> <br> * Step 1-4<br> Move AWStats <b>icon sub-directories</b> and its content into a directory readable by your web server, for example /yourwwwroot/icon or /yourwwwroot/icons.<br> <br> * Step 1-5<br> Copy <b>awstats.model.conf</b> file into a new file named <b>awstats.myvirtualhostname.conf</b>. This new file must be stored in<br> - /etc/awstats or /etc/opt/awstats or /etc or same directory than awstats.pl (so cgi-bin) for Unix/Linux users.<br> - same directory than awstats.pl (so cgi-bin) for Windows and other OS.<br> <br> * Step 1-6<br> Edit this new config file with your own setup :<br> - Change <a href="awstats_config.html#LogFile">LogFile</a> value with full path of your web server log file (You can also use a relative path from your awstats.pl directory).<br> - Change <a href="awstats_config.html#LogType">LogType</a> value with "W" for analyzing web server log files, "M" for mail log files, "F" for ftp log files, "O" otherwise.<br> - Check if <a href="awstats_config.html#LogFormat">LogFormat</a> has the value "1" (it means "NCSA apache combined/ELF/XLF log format").<br> - Change <a href="awstats_config.html#DirIcons">DirIcons</a> parameter to reflect relative path of icon directory.<br> - Edit <a href="awstats_config.html#SiteDomain">SiteDomain</a> parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).<br> - You can change other parameters if you want.<br> <br> Step 1 (Install and Setup) is finished. You can jump to the <a href="#BUILD_UPDATE">Build/Update Statistics</a> section.<br> <br> <br> <br> <b>B) With IIS server</b><br> <br> * Step 1-1<br> Configure IIS to log in <b>"Extended W3C log format"</b> (You can still use your own log format but setup is easier if made like suggested). So, for this, start the IIS Snap-in, select the web site and look at its Properties. Choose W3C Extended Log Format, then Properties, then the Tab Extended Properties and uncheck everything under Extended Properties. Once they are all unchecked, check all following fields:<br> <i> date<br> time<br> c-ip<br> cs-username<br> cs-method<br> cs-uri-stem<br> sc-status<br> sc-bytes<br> cs-version<br> cs(User-Agent)<br> cs(Referer)<br> </i> To be sure the log format change is effective, you must stop IIS, remove all old log files, restart IIS and go to your homepage. This is an example of records you should get then in the new log file:<br> <i>2000-07-19 14:14:14 62.161.78.73 - GET / 200 1234 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0) http://www.from.com/from.htm</i><br> <br> * Step 1-2<br> Copy the contents of the uncompressed cgi-bin folder from your hard drive to your server's cgi-bin directory (this includes <b>awstats.pl</b>, <b>awstats.model.conf</b>, and the <b>lang</b>, <b>lib</b> and <b>plugins</b> sub-directories).<br> <br> * Step 1-3<br> Move AWStats <b>icon sub-directories</b> and its content into a directory readable by your web server, for example C:\yourwwwroot\icon.<br> <br> * Step 1-4<br> Copy <b>awstats.model.conf</b> file into a new file named <b>awstats.myvirtualhostname.conf</b>. This new file must be stored in<br> - same directory than awstats.pl (so cgi-bin)<br> <br> * Step 1-5<br> Edit this new config file with your own setup :<br> - Change <a href="awstats_config.html#LogFile">LogFile</a> value with full path of your web server log file (You can also use a relative path from your awstats.pl directory).<br> - Change <a href="awstats_config.html#LogType">LogType</a> value with "W" for analyzing web server log files, "M" for mail log files, "F" for ftp log files, "O" otherwise.<br> - Change <a href="awstats_config.html#LogFormat">LogFormat</a> to value "2" (it means "IIS Extended W3C log format").<br> - Change <a href="awstats_config.html#DirIcons">DirIcons</a> parameter to reflect relative path of icon directory.<br> - Edit <a href="awstats_config.html#SiteDomain">SiteDomain</a> parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).<br> - You can change other parameters if you want.<br> <br> Step 1 (Install and Setup) is finished. You can jump to the <a href="#BUILD_UPDATE">Build/Update Statistics</a> section.<br> <br> <br> <br> <b>C) With other web servers</b><br> <br> Setup process is similar to setup for Apache or IIS.<br> Use <a href="awstats_config.html#LogFormat">LogFormat</a> to value "3" if you have WebStar native log format.<br> <br> <br> <br> <a name="BUILD_UPDATE"><H2 style="font: 22px arial,helvetica,sanserif color: #606060"><u>Step 2 : Build/Update Statistics</u></H2></a> <br> * Step 2-1<br> The first analyze/update of statistics can be made the first time manually from the command line (the first time, process may be long) :<br> <b><i>awstats.pl -config=myvirtualhostname -update</i></b><br> <br> AWStats will read the config file awstats.myvirtualhostname.conf (or if not found, awstats.conf) and create/update its database with all summary information issued from analyzed log file.<br> AWStats database files are saved in directory defined by <a href="awstats_config.html#DirData">DirData</a> parameter in config file.<br> When update is finished, you should get a result like this:<br> <i>Lines in file: 225730<br> Found 5 dropped records,<br> Found 124 corrupted records,<br> Found 0 old records,<br> Found 225601 new records.<br> </i><br> <b>Dropped records</b> are records discarded because they were not user HTTP request or requests were not qualified by AWStats filters (See <a href="awstats_config.html#SkipHosts">SkipHosts</a>, <a href="awstats_config.html#SkipUserAgents">SkipUserAgents</a>, <a href="awstats_config.html#SkipFiles">SkipFiles</a>, and <a href="awstats_config.html#OnlyFiles">OnlyFiles</a> parameters). If you want to see which lines were dropped, you can add the <b>-showdropped</b> option on command line.<br> <b>Corrupted records</b> are records that does not match log format defined by "LogFormat" parameter in AWStats config/domain file. With all webservers you can experience a little bit corrupted records (<5%) even when everythings work correctly. This can be the result of several reasons: Web server internal bugs, bad requests made by buggy browsers, web server brutal stop...<br> If all your lines are corrupted and <a href="awstats_config.html#LogFormat">LogFormat</a> parameter in AWStats config/domain file is correct, it may be the log format setup in your web server that is wrong. Don't forget that your <a href="awstats_config.html#OnlyFiles">LogFormat</a> parameter in AWStats config/domain file MUST match the log file format you analyze.<br> If you want to see which lines are corrupted, you can add the <b>-showcorrupted</b> option on command line.<br> <b>Old records</b> are simply records that were already processed by a previous update process. So it's not necessary to purge your log file after each update process even if it's highly recommended to do it as often as possible.<br> <b>New records</b> are records in your log file that were successfully used to build/update statistics.<br> <br> Note : A log analysis process is slow (one second for each 4500 lines of your logfile with Athlon 1Ghz, plus DNS resolution time for each different IP address in your logfile if <a href="awstats_config.html#DNSLookup">DNSLookup</a> is set to 1 and not already done in your log file).<br> See <a href="awstats_benchmark.html">Benchmark page</a> for more accurate information.<br> <br> * Step 2-2<br> Even if AWStats allows "real-time" statistics with its "update from browser feature" (See next section <a href="#READ">Read Statistics</a>), you should run an update process from a scheduler (command is same than first process) frequently.<br> <br> You have two choice:<br> - Include the update in your <b>logrotate</b> process. See <a href="awstats_faq.html#ROTATE">FAQ-COM120</a> for this.<br> - Or add instructions in your <b>crontab</b> (Unix/Linux) or your <b>task scheduler</b> (for Windows), to launch frequently this Awstats update process. See <a href="awstats_faq.html#CRONTAB">FAQ-COM130</a> for this.<br><br> See AWStats <a href="awstats_benchmark.html">Benchmark page</a> for recommanded update/logrotate frequency.<br> <br> <br> <br><a name="READ"><H2 style="font: 22px arial,helvetica,sanserif color: #606060"><u>Step 3 : Read Statistics</u></H2></a> <br> To see results of analyze, you have several solutions depending on your <a href="awstats_security.html">security policy</a>.<br> <br> * First solution is to build the main reports, in a static HTML page, from the command line, like this :<br> <b><i>perl awstats.pl -config=myvirtualhostname -output -staticlinks > awstats.myvirtualhostname.html</i></b><br> <br> You can also use all other output options (each of them give you another report). This is how to use all other possible output options(1) :<br> <i><b>perl awstats.pl -config=myvirtualhostname -output=allhosts -staticlinks > awstats.myvirtualhostname.allhosts.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=lasthosts -staticlinks > awstats.myvirtualhostname.lasthosts.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=unknownip -staticlinks > awstats.myvirtualhostname.unknownip.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=alllogins -staticlinks > awstats.myvirtualhostname.alllogins.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=lastlogins -staticlinks > awstats.myvirtualhostname.lastlogins.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=allrobots -staticlinks > awstats.myvirtualhostname.allrobots.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=lastrobots -staticlinks > awstats.myvirtualhostname.lastrobots.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=urldetail -staticlinks > awstats.myvirtualhostname.urldetail.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=urlentry -staticlinks > awstats.myvirtualhostname.urlentry.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=urlexit -staticlinks > awstats.myvirtualhostname.urlexit.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=browserdetail -staticlinks > awstats.myvirtualhostname.browserdetail.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=osdetail -staticlinks > awstats.myvirtualhostname.osdetail.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=unknownbrowsers -staticlinks > awstats.myvirtualhostname.unknownbrowsers.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=unknownos -staticlinks > awstats.myvirtualhostname.unknownos.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=refererse -staticlinks > awstats.myvirtualhostname.refererse.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=refererpages -staticlinks > awstats.myvirtualhostname.refererpages.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=keyphrases -staticlinks > awstats.myvirtualhostname.keyphrases.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=keywords -staticlinks > awstats.myvirtualhostname.keywords.html</b></i><br> <i><b>perl awstats.pl -config=myvirtualhostname -output=errors404 -staticlinks > awstats.myvirtualhostname.errors404.html</b></i><br> <br> Note (1): If you prefer, you can use <a href="awstats_tools.html#awstats_buildstaticpages">awstats_buildstaticpages</a> tool to build all those pages in one command.<br> <br> Note (2): You can also add a <i>filter</i> on the following output reports:<b>urldetail, urlentry, urlexit, allhosts, refererpages</b>.<br> <i>filter</i> can be a regexp on the full key you want awstats to present information about and you must use it after the output parameter separated by a ":".<br> For example, to output the urldetail report, with a filter on all pages that contains /news, you can use the following command line:<br> <i><b>perl awstats.pl -config=myvirtualhostname -output=urldetail:</b>/news<b> -staticlinks > awstats.myvirtualhostname.urldetailwithfilter.html</b></i><br> <br> Note (3): If you want to build a report for a particular month, add options <i><b>-month=MM -year=YYYY</b></i>.<br> To build a report for full year (warning: This may use a lot of memory and CPU), add options <i><b>-month=all -year=YYYY</b></i>.<br> <br><br> * Another solution is to view dynamically your statistics from a browser. For this use URL:<br> <b><i>http://www.myserver.mydomain/cgi-bin/awstats.pl?config=myvirtualhostname</i></b><br> where <i>myvirtualhostname</i> is used to know which config file to use (AWStats will use awstats.<i>myvirtualhostname</i>.conf file).<br> <br> Note (1): All output command line options (except -staticlinks) are still available when using AWStats as a browser.<br> Just use them as URL parameters like this example <b><i>http://www.myserver.mydomain/cgi-bin/awstats.pl?month=MM&year=YYYY&output=unknownos</i></b><br> <br> Note (2): If <a href="awstats_config.html#AllowToUpdateStatsFromBrowser">AllowToUpdateStatsFromBrowser</a> parameter is set to 1 in AWStats config/domain file, you will also be able to run the update process from your browser. Just click on link "Update now".<br> <br><br> <hr> <script language=javascript> var lastmod = new Date(document.lastModified); if (lastmod.getDate() > 0) { if (lastmod.getDate()<10) zerod="0" else zerod=""; if (lastmod.getMonth()<9) zerom="0" else zerom="" year2kok=lastmod.getYear(); if (year2kok<100) year2kok+=2000; if ((year2kok>=100) && (year2kok < 1970)) year2kok+=1900; document.writeln("Last revision: "+year2kok+"-"+zerom+(lastmod.getMonth()+1)+"-"+zerod+lastmod.getDate()); } </script> </body> </html>