検索

awstats 网站访问量统计,主要用于Web Server为Apache

Install, Setup and Use AWStats
AWStats common use is made in 3 steps:

Step 0 : The install and setup
Step 1 : The build/update of statistics

Step 2 : The reading of results


Before starting, check that your Perl version is at least 5.005_03 (or higher) by running the perl -v command. If not, you can install a recent Perl interpreter from ActivePerl (Win32) or Perl.com (Unix/Linux/Other).
-->

Step 0 : Install and Setup with awstats_configure.pl

A) With Apache or compatible server (on Unix/Linux, Windows, MacOS...)

* Step 0-1:
(if you use a package provided with a Linux distribution or Windows installer, action done in step 0-1 might have already be done, if you don't know you, do it again)

After downloading and extracting the AWStats package, you should run the awstats_configure.pl script to do several setup actions. You will find it in the AWStats tools directory (If using the windows installer, the script is automatically launched):
perl awstats_configure.pl

This is what the script do/ask (you can do all those steps manually instead of running awstats_configure.pl if you prefer):

A) awstats_configure.pl try to find your Apache web server config file (ask path if not found) and check inside your server log format configuration. If you use a common log, awstats_configure.pl will suggest to change it to have NCSA combined/XLF/ELF log format (you can use your own log format but this predefined logformat is often the best choice and make setup easier).
If you answer yes, awstats_configure.pl will modify your httpd.conf to change all the following directives:
CustomLog /yourlogpath/yourlogfile common
into
CustomLog /yourlogpath/yourlogfile combined

See your Apache manual for more information on this directive.
To be sure the log format change is effective, later 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:
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)"

B) Then, awstats_configure.pl will add, if not already present, the following directives to your Apache config file (note that the "/usr/local/awstats/wwwroot" path might differ according to your distribution or OS:

#
# Directives to add to your Apache conf file to allow use of AWStats as a CGI.
# Note that path "/usr/local/awstats/" must reflect your AWStats install path.
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#

Options None
AllowOverride None
Order allow,deny
Allow from all

C) awstats_configure.pl restart Apache to apply the changes made in A and B (if changes were made).

D) awstats_configure.pl will ask you a name for a config profile file. Enter here the name of your web server or any analysis profile name, for example myvirtualhostname.
So awstats_configure.pl will copy the file awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. You can use the value of your choice instead of "myvirtualhostname". This new file is stored into:
- For Linux/BSD/Unix users: /etc/awstats.
- For Mac OS X, Windows and other OS: Same directory than awstats.pl (so cgi-bin).

E) awstats_configure.pl ends.


* Step 0-2:
Once a config file has been automatically created (by awstats_configure.pl, by your package installer or just by a manual copy of awstats.model.conf), it's important to edit it manually and change the "MAIN PARAMETERS" to match all your needs:

This is for example the parameters you should check seriously :
- Check/Change LogFile value with full path of your server log file (You can also use a relative path from your awstats.pl directory, but full path avoid errors).
- Check/Change LogType value with "W" for analyzing web server log files, "S" for a streaming server log file, "M" for mail log files, "F" for ftp log files.
- Check if LogFormat has the value "1" (it means "NCSA apache combined/ELF/XLF log format") or use a personalized log format if you don't use combined log format.
- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com). If you have several possible name for same site, add list in HostAlias parameter.
- You can also change other parameters if you want.

Step 0 (Install and Setup) is finished. You can jump to the Build/Update Statistics section.

 

B) With IIS server

* Step 0-1:

Configure IIS to log in "Extended W3C log format" (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:
date
time
c-ip
cs-username
cs-method
cs-uri-stem
cs-uri-query
sc-status
sc-bytes
cs-version
cs(User-Agent)
cs(Referer)
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:
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

* Step 0-2:

Copy the contents of the provided cgi-bin folder from your hard drive to your server's cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).

* Step 0-3:

Move AWStats icon sub-directories and its content into a directory readable by your web server, for example C:/yourwwwroot/icon.

* Step 0-4:

Create a config file by copying awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. You can use the value of your choice instead of "myvirtualhostname". This new file must be stored in
- Same directory than awstats.pl (so cgi-bin)

* Step 0-5:

Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file (You can also use a relative path from your awstats.pl directory).
- Change LogType value with "W" for analyzing web server log files, "S" for a streaming server log file, "M" for mail log files, "F" for ftp log files, "O" otherwise.
- Change LogFormat to a value with same field's name defined in step 0-1:
LogFormat="date time c-ip cs-username cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-version cs(User-Agent) cs(Referer)"
- Change DirIcons parameter to reflect relative path of icon directory.
- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).
- Set AllowToUpdateStatsFromBrowser parameter to 1 if you don't have command line access and have only cgi access.
- You can change other parameters if you want.

Step 0 (Install and Setup) is finished. You can jump to the Build/Update Statistics section.

 

C) With other web servers

Setup process is similar to setup for Apache or IIS.
Use LogFormat to value "3" if you have WebStar native log format, use a personalized LogFormat if your log format is other.

 


Step 1 : Build/Update Statistics

* Step 1-1:

The first analyze/update of statistics should be made the first time manually from the command line since first time, process may be long and it's easier to solve problems (if you don't have Command Line access, just go to Step 1-2). The AWStats update command line is:
awstats.pl -config=myvirtualhostname -update

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.
AWStats database files are saved in directory defined by DirData parameter in config file.
When update is finished, you should get on screen a result like this:

Update for config "/etc/awstats/awstats.myvirtualhostname.conf"
With data in log file "/pathtoyourlog/yourlog.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 225730
 Found 122 dropped records,
 Found 87 corrupted records,
 Found 0 old records,
 Found 225521 new qualifed records.

Dropped records are records discarded because they were not user HTTP request or requests were not qualified by AWStats filters (See SkipHosts, SkipUserAgents, SkipFiles, OnlyHosts, OnlyUserAgents and OnlyFiles parameters). If you want to see which lines were dropped, you can add the -showdropped option on command line.
Corrupted records 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 (If all your lines are corrupted and LogFormat 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 LogFormat parameter in AWStats config/domain file MUST match the log file format you analyze.
If you want to see which lines are corrupted, you can add the -showcorrupted option on command line.
Old records are simply records that were already processed by a previous update process. You understood that 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.
New records are records in your log file that were successfully used to build/update statistics.

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 DNSLookup is set to 1 and not already done in your log file).
See Benchmark page for more accurate information.

* Step 1-2:

AWStats statistics can be updated from a browser, to provide real-time statistics, by clicking the "Update now" link that appears when AWStats is used as a CGI (Next section 'Read Statistics dynamically' gives you URL to use for that).
Warning !!
To enable this link, your parameter AllowToUpdateStatsFromBrowser must be set to 1 in your config file (Link is not enabled by default).

Then, using on-line update does not prevent you from running the update process from a scheduler frequently (command is same than update of first process).
For this, you have two choices:
- Include the update command in your logrotate process. See FAQ-COM120 for this.
- Or add instructions in your crontab (Unix/Linux) or your task scheduler (for Windows), to launch frequently the Awstats update process. See FAQ-COM130 for this.

See AWStats Benchmark page for recommanded update/logrotate frequency.

 


Step 2 : Read Statistics

To see results of analyze, you have several solutions depending on your security policy.

* First solution is to build the main reports, in a static HTML page, from the command line, like this (jump to second solution if you have ONLY CGI access):
perl awstats.pl -config=myvirtualhostname -output -staticlinks > awstats.myvirtualhostname.html

You can use all other output options (each of them give you another report). This is how to use all other possible output options(1) :
perl awstats.pl -config=myvirtualhostname -output=alldomains -staticlinks > awstats.myvirtualhostname.alldomains.html
perl awstats.pl -config=myvirtualhostname -output=allhosts -staticlinks > awstats.myvirtualhostname.allhosts.html
perl awstats.pl -config=myvirtualhostname -output=lasthosts -staticlinks > awstats.myvirtualhostname.lasthosts.html
perl awstats.pl -config=myvirtualhostname -output=unknownip -staticlinks > awstats.myvirtualhostname.unknownip.html
perl awstats.pl -config=myvirtualhostname -output=alllogins -staticlinks > awstats.myvirtualhostname.alllogins.html
perl awstats.pl -config=myvirtualhostname -output=lastlogins -staticlinks > awstats.myvirtualhostname.lastlogins.html
perl awstats.pl -config=myvirtualhostname -output=allrobots -staticlinks > awstats.myvirtualhostname.allrobots.html
perl awstats.pl -config=myvirtualhostname -output=lastrobots -staticlinks > awstats.myvirtualhostname.lastrobots.html
perl awstats.pl -config=myvirtualhostname -output=urldetail -staticlinks > awstats.myvirtualhostname.urldetail.html
perl awstats.pl -config=myvirtualhostname -output=urlentry -staticlinks > awstats.myvirtualhostname.urlentry.html
perl awstats.pl -config=myvirtualhostname -output=urlexit -staticlinks > awstats.myvirtualhostname.urlexit.html
perl awstats.pl -config=myvirtualhostname -output=browserdetail -staticlinks > awstats.myvirtualhostname.browserdetail.html
perl awstats.pl -config=myvirtualhostname -output=osdetail -staticlinks > awstats.myvirtualhostname.osdetail.html
perl awstats.pl -config=myvirtualhostname -output=unknownbrowser -staticlinks > awstats.myvirtualhostname.unknownbrowser.html
perl awstats.pl -config=myvirtualhostname -output=unknownos -staticlinks > awstats.myvirtualhostname.unknownos.html
perl awstats.pl -config=myvirtualhostname -output=refererse -staticlinks > awstats.myvirtualhostname.refererse.html
perl awstats.pl -config=myvirtualhostname -output=refererpages -staticlinks > awstats.myvirtualhostname.refererpages.html
perl awstats.pl -config=myvirtualhostname -output=keyphrases -staticlinks > awstats.myvirtualhostname.keyphrases.html
perl awstats.pl -config=myvirtualhostname -output=keywords -staticlinks > awstats.myvirtualhostname.keywords.html
perl awstats.pl -config=myvirtualhostname -output=errors404 -staticlinks > awstats.myvirtualhostname.errors404.html

Note (1): If you prefer, you can use awstats_buildstaticpages tool to build all those pages in one command or to generate PDF files.

Note (2): You can also add a filter on the following output reports:urldetail, urlentry, urlexit, allhosts, refererpages.
filter 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 ":".
For example, to output the urldetail report, with a filter on all pages that contains /news, you can use the following command line:
perl awstats.pl -config=myvirtualhostname -output=urldetail:/news -staticlinks > awstats.myvirtualhostname.urldetailwithfilter.html

Note (3): If you want to build a report for a particular month, add options -month=MM -year=YYYY.
To build a report for full year (warning: This may use a lot of memory and CPU), add options -month=all -year=YYYY.


* Second solution is to view dynamically your statistics from a browser. For this, use URL:
http://www.myserver.mydomain/awstats/awstats.pl?config=myvirtualhostname
where myvirtualhostname is used to know which config file to use (AWStats will use awstats.myvirtualhostname.conf file).

Note (1): All output command line options (except -staticlinks) are still available when using AWStats as a browser.
Just use them as URL parameters like this example http://www.myserver.mydomain/awstats/awstats.pl?month=MM&year=YYYY&output=unknownos

Note (2): If AllowToUpdateStatsFromBrowser 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".

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
MySQL Index Cardinalityはクエリパフォーマンスにどのように影響しますか?MySQL Index Cardinalityはクエリパフォーマンスにどのように影響しますか?Apr 14, 2025 am 12:18 AM

MySQLインデックスのカーディナリティは、クエリパフォーマンスに大きな影響を及ぼします。1。高いカーディナリティインデックスは、データ範囲をより効果的に狭め、クエリ効率を向上させることができます。 2。低カーディナリティインデックスは、完全なテーブルスキャンにつながり、クエリのパフォーマンスを削減する可能性があります。 3。ジョイントインデックスでは、クエリを最適化するために、高いカーディナリティシーケンスを前に配置する必要があります。

MySQL:新規ユーザー向けのリソースとチュートリアルMySQL:新規ユーザー向けのリソースとチュートリアルApr 14, 2025 am 12:16 AM

MySQL学習パスには、基本的な知識、コアの概念、使用例、最適化手法が含まれます。 1)テーブル、行、列、SQLクエリなどの基本概念を理解します。 2)MySQLの定義、作業原則、および利点を学びます。 3)インデックスやストアドプロシージャなどの基本的なCRUD操作と高度な使用法をマスターします。 4)インデックスの合理的な使用や最適化クエリなど、一般的なエラーのデバッグとパフォーマンス最適化の提案に精通しています。これらの手順を通じて、MySQLの使用と最適化を完全に把握できます。

実際のmysql:例とユースケース実際のmysql:例とユースケースApr 14, 2025 am 12:15 AM

MySQLの実際のアプリケーションには、基本的なデータベース設計と複雑なクエリの最適化が含まれます。 1)基本的な使用法:ユーザー情報の挿入、クエリ、更新、削除など、ユーザーデータの保存と管理に使用されます。 2)高度な使用法:eコマースプラットフォームの注文や在庫管理など、複雑なビジネスロジックを処理します。 3)パフォーマンスの最適化:インデックス、パーティションテーブル、クエリキャッシュを使用して合理的にパフォーマンスを向上させます。

MySQLのSQLコマンド:実用的な例MySQLのSQLコマンド:実用的な例Apr 14, 2025 am 12:09 AM

MySQLのSQLコマンドは、DDL、DML、DQL、DCLなどのカテゴリに分割でき、データベースとテーブルの作成、変更、削除、データの挿入、更新、削除、複雑なクエリ操作の実行に使用できます。 1.基本的な使用には、作成可能な作成テーブル、INSERTINTO INSERTデータ、クエリデータの選択が含まれます。 2。高度な使用法には、テーブル結合、サブQueries、およびデータ集約のためのグループに参加します。 3.構文エラー、データ型の不一致、許可の問題などの一般的なエラーは、構文チェック、データ型変換、許可管理を介してデバッグできます。 4.パフォーマンス最適化の提案には、インデックスの使用、フルテーブルスキャンの回避、参加操作の最適化、およびデータの一貫性を確保するためのトランザクションの使用が含まれます。

InnoDBは酸コンプライアンスをどのように処理しますか?InnoDBは酸コンプライアンスをどのように処理しますか?Apr 14, 2025 am 12:03 AM

INNODBは、ロックメカニズムとMVCCを通じて、非論的、一貫性、および分離を通じて原子性を達成し、レッドログを介した持続性を達成します。 1)原子性:Undologを使用して元のデータを記録して、トランザクションをロールバックできることを確認します。 2)一貫性:行レベルのロックとMVCCを介してデータの一貫性を確保します。 3)分離:複数の分離レベルをサポートし、デフォルトでrepeatable -readが使用されます。 4)持続性:Redologを使用して修正を記録し、データが長時間保存されるようにします。

MySQLの場所:データベースとプログラミングMySQLの場所:データベースとプログラミングApr 13, 2025 am 12:18 AM

データベースとプログラミングにおけるMySQLの位置は非常に重要です。これは、さまざまなアプリケーションシナリオで広く使用されているオープンソースのリレーショナルデータベース管理システムです。 1)MySQLは、効率的なデータストレージ、組織、および検索機能を提供し、Web、モバイル、およびエンタープライズレベルのシステムをサポートします。 2)クライアントサーバーアーキテクチャを使用し、複数のストレージエンジンとインデックスの最適化をサポートします。 3)基本的な使用には、テーブルの作成とデータの挿入が含まれ、高度な使用法にはマルチテーブル結合と複雑なクエリが含まれます。 4)SQL構文エラーやパフォーマンスの問題などのよくある質問は、説明コマンドとスロークエリログを介してデバッグできます。 5)パフォーマンス最適化方法には、インデックスの合理的な使用、最適化されたクエリ、およびキャッシュの使用が含まれます。ベストプラクティスには、トランザクションと準備された星の使用が含まれます

MySQL:中小企業から大企業までMySQL:中小企業から大企業までApr 13, 2025 am 12:17 AM

MySQLは、中小企業に適しています。 1)中小企業は、顧客情報の保存など、基本的なデータ管理にMySQLを使用できます。 2)大企業はMySQLを使用して、大規模なデータと複雑なビジネスロジックを処理して、クエリのパフォーマンスとトランザクション処理を最適化できます。

Phantomの読み取りとは何ですか?Innodbはどのようにそれらを防ぐ(次のキーロック)?Phantomの読み取りとは何ですか?Innodbはどのようにそれらを防ぐ(次のキーロック)?Apr 13, 2025 am 12:16 AM

INNODBは、次のキーロックメカニズムを通じてファントムの読み取りを効果的に防止します。 1)Next-KeyLockingは、Row LockとGap Lockを組み合わせてレコードとギャップをロックして、新しいレコードが挿入されないようにします。 2)実際のアプリケーションでは、クエリを最適化して分離レベルを調整することにより、ロック競争を削減し、並行性パフォーマンスを改善できます。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

VSCode Windows 64 ビットのダウンロード

VSCode Windows 64 ビットのダウンロード

Microsoft によって発売された無料で強力な IDE エディター

Dreamweaver Mac版

Dreamweaver Mac版

ビジュアル Web 開発ツール

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。