AWStats

 AWStats


[root@falcon21 ~]# yum -y install awstats

[root@falcon21 ~]# vi `rpm -ql awstats|grep "awstats\.pl"`

[root@falcon21 ~]# rpm -ql awstats|grep "awstats\.pl"
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl

[root@falcon21 ~]# vi /usr/share/awstats/wwwroot/cgi-bin/awstats.pl
9932 #"$Message[5] $MonthNumLib{$MonthRequired} $YearRequired";
9933 "$YearRequired$Message[6] ".$MonthNumLib{$MonthRequired}; 

12610 print( $MonthRequired eq 'all'
12611 ? "$Message[6] $YearRequired"
12612 #: "$Message[5] "
12613 #. $MonthNumLib{$MonthRequired}
12614 #. " $YearRequired"
12615 : "$YearReperl /usr/local/awstats/tools/awstats_configure.plquired$Message[6] $MonthNumLib{$MonthRequired}"
12616 );

13078 #print "$MonthNumLib{$monthix}<br />$YearRequired";
13079 print "$YearRequired$Message[6]<br />$MonthNumLib{$monthix}";
perl /usr/local/awstats/tools/awstats_configure.pl
13082 #print "$MonthNumLib{$monthix} $YearRequired";
13083 printperl /usr/local/awstats/tools/awstats_configure.pl "$YearRequired$Message[6] $MonthNumLib{$monthiperl /usr/local/awstats/tools/awstats_configure.plx}";
perl /usr/local/awstats/tools/awstperl /usr/local/awstats/tools/awstats_configure.plats_configure.pl
-
*********************************************
awstats_configure

[root@falcon21 ~]# perl /usr/share/awstats/tools/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
Warning: AWStats standard directory on Linux OS is '/usr/share/awstats'.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/root
to standard directory:
/usr/share/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? 

y

-----> 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):
> /etc/httpd/conf.d/awstats.conf]
- This file does not exists.
Config file path ('none' to skip web server setup):
> none

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 '/etc/awstats/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:
> falcon21.space

-----> 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):

Warning: A config file for this name already exists. Choose another one.
Your web site, virtual server or profile name:
> anpachi.moe.hm

-----> 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.anpachi.moe.hm.conf'
Config file /etc/awstats/awstats.anpachi.moe.hm.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:
/root/wwwroot/cgi-bin/awstats.pl -update -config=anpachi.moe.hm
Or if you have several config files and prefer having only one command:
/root/tools/awstats_updateall.pl now
Press ENTER to continue... 


A SIMPLE config file has been created: /etc/awstats/awstats.anpachi.moe.hm.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'anpachi.moe.hm' with command:
> perl awstats.pl -update -config=anpachi.moe.hm
You can also build static report pages for 'anpachi.moe.hm' with command:
> perl awstats.pl -output=pagetype -config=anpachi.moe.hm

Press ENTER to finish...

*************************************************************

------------
AWStats設定 

[root@falcon21 ~]# rm -f /etc/awstats/awstats.localhost.localdomain.conf
[root@falcon21 ~]# rm -f /etc/awstats/awstats.`hostname`.conf


[root@falcon21 ~]# vi /etc/awstats/awstats.falcon21.space.conf
153 SiteDomain="falcon21.space"
168 HostAliases="localhost 127.0.0.1" REGEX[^192\.168\.1\.]"
188 DNSLookup=1
1410 LoadPlugin="geoipfree"
perl /usr/local/awstats/tools/awstats_configure.pl

[root@falcon21 ~]# yum -y install perl-CPAN

[root@falcon21 ~]# perl -MCPAN -e shell
:
:
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.

cpan[1]> install Geo::IPfree ← Geo::IPfreeモジュールインストールperl /usr/local/awstats/tools/awstats_configure.pl

cpan[2]> quit ← perl-CPAN終了
Terminal does not support GetHistory.
Lockfile removed.

------------------------------------------
Apache設定

[root@falcon21 ~]# vi /etc/httpd/conf.d/awstats.conf
1 #
2 # Content of this file, with correct values, can be automatically added to
3 # your Apache server by using the AWStats configure.pl tool.
4 #


7 # If using Windows and Perl ActiveStat, this is to enable Perl script as CGI.
8 #ScriptInterpreterSource registry

10 
11 #
12 # Directives to add to your Apache conf file to allow use of AWStats as a CGI.
13 # Note that path "/usr/share/awstats/" must reflect your AWStats install path.
14 #
15 Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
16 Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
17 Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"perl /usr/local/awstats/tools/awstats_configure.pl
18 ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"
19 
20 
21 #
22 # This is to permit URL access to scripts/files in AWStats directory.
23 #
24 <Directory "/usr/share/awstats/wwwroot">
25 Options None
26 AllowOverride None
27 Order allow,deny
28 Allow from 127.0.0.1 192.168.1.0/32 192.168.0.0/32perl /usr/local/awstats/tools/awstats_configure.pl
29 </Directory>
30 # Additional Perl modules
31 <IfModule mod_env.c>
32 SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
33 </IfModule>


----------------------------
[root@falcon21 ~]# /etc/rc.d/init.d/httpd reload
httpd を再読み込み中: 

http://falcon21.space/awstats/awstats.pl
Forbidden

You don't have permission to access /awstats/awstats.pl on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------


AWStatsデータベース初期作成
[root@falcon21 ~]# vi awstatsinit.sh
#!/bin/sh

logfile=`grep ^LogFile /etc/awstats/awstats.$1.conf|sed -e 's/LogFile="\([^ ]*\)"/\1/p' -e d`
for log in `ls $logfile*|sort -r`
do
`rpm -ql awstats|grep "awstats\.pl"` \
-config=$1 -update -logfile=$log
done


# 現在ログ処理
for Apache設定log in `ls $logfile|sort`
do
`rpm -ql awstats|grep "awstats\.pl"` \
-config=$1 -update -logfile=$log
done

-------------------------------------------------------------------
Apache設定
[root@falcon21 ~]# sh awstatsinit.sh falcon21.space
Create/Update database for config "/etc/awstats/awstats.falcon21.space.conf" by AWStats version 7.0 (build 1.971)
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 12398)
Jumped lines in file: 12398
Found 12398 already parsed records.
Parsed lines in file: 84
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 84 new qualified records.


---------------------------------
ApApache設定acheログローテーション設定
[root@falcon21 ~]# vi /etc/logrotate.d/httpd

5 Apache設定 prerotate
6 `rpm -ql awstats|grep "awstats_updateall\.pl"` now -confdir="/etc/awstats" \
7 -awstatsprog="`rpm -ql awstats|grep "awstats\.pl"`" >/dev/null
8 endscript


--------------------------------
[root@falcon21 ~]# /etc/rc.d/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]


http://falcon21.space/awstats/awstats.pl にアクセス、表示確認

投票数:2 平均点:10.00

 
Back to Top