Awstats を利用することにより, Apache , Squid 及び Postfix のアクセスログを解析することができます。
| #AddHandler cgi-script .cgi |
| $ sudo apt-get install awstats |
| $ perl /usr/share/doc/awstats/examples/awstats_configure.pl ・ ・ ・ Config file path ('none' to skip web server setup): > /etc/apache2/apache2.conf ←Apache の設定ファイルを指定 ・ ・ ・ Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ?: y ←Awstats の設定ファイルを作成 ・ ・ ・ Your web site, virtual server or profile name: > shitomi.jp ←サイト名を指定 ・ ・ ・ Directory path to store config file(s) (Enter for default): > [リターンキー] ←デフォルト設定 ・ ・ ・ |
Alias /awstatsclasses "/usr/share/awstats/lib/" |
| $ sudo a2ensite awstats |
$ sudo /etc/init.d/apache2 restart |
| LogFile="/var/log/apache2/access.log" LogType=W LogFormat=1 # 当サイトのドメイン名 SiteDomain="www.shitomi.jp" # 上記以外の当サイトのドメイン名(正規表現) HostAliases="REGEX[^.*\.shitomi\.(net|com)$]" DNSLookup=1 DirData="/var/lib/awstats" DirCgi="/awstats" DirIcons="/awstatsicons" EnableLockForUpdate=1 # 閲覧を許可する IP アドレスの範囲 AllowAccessFromWebToFollowingIPAddresses="192.168.0.1-192.168.0.254" # 統計情報の処理対象外にする IP アドレスを指定 SkipHosts="127.0.0.1 REGEX[^192\.168\.0\.]" Lang="jp" |
| $ sudo /usr/lib/cgi-bin/awstats.pl -config=apache |
| 0,10,20,30,40,50 * * * * root /usr/lib/cgi-bin/awstats.pl -config=apache -update >/dev/null |
| LogFile="/var/log/squid/access.log" LogType=W LogFormat=4 # 当サイトのドメイン名 SiteDomain="ns.shitomi.jp" DNSLookup=2 DirData="/var/lib/awstats" DirCgi="/awstats" DirIcons="/awstatsicons" EnableLockForUpdate=1 # 閲覧を許可する IP アドレスの範囲 AllowAccessFromWebToFollowingIPAddresses="192.168.0.1-192.168.0.254" Lang="jp" LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForSearchEnginesDetection=0 LevelForKeywordsDetection=0 LevelForWormsDetection=0 ShowDomainsStats=0 ShowRobotsStats=0 ShowFileSizesStats=0 ShowOSStats=0 ShowBrowsersStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 |
| $ sudo /usr/lib/cgi-bin/awstats.pl -config=squid |
| 0,10,20,30,40,50 * * * * root /usr/lib/cgi-bin/awstats.pl -config=squid -update >/dev/null |
| LogFile="perl /usr/share/doc/awstats/examples/maillogconvert.pl standard < /var/log/mail.log |" LogType=M LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" # 当サイトのドメイン名 SiteDomain="mail.shitomi.jp" DNSLookup=2 DirData="/var/lib/awstats" DirCgi="/awstats" DirIcons="/awstatsicons" EnableLockForUpdate=1 # 閲覧を許可する IP アドレスの範囲 AllowAccessFromWebToFollowingIPAddresses="192.168.0.1-192.168.0.254" Lang="jp" LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForSearchEnginesDetection=0 LevelForKeywordsDetection=0 LevelForFileTypesDetection=0 LevelForWormsDetection=0 ShowMonthStats=UHB ShowDaysOfMonthStats=HB ShowDaysOfWeekStats=HB ShowHoursStats=HB ShowDomainsStats=0 ShowHostsStats=HBL ShowRobotsStats=0 ShowEMailSenders=HBML ShowEMailReceivers=HBML ShowSessionsStats=0 ShowPagesStats=0 ShowFileTypesStats=0 ShowFileSizesStats=0 ShowOSStats=0 ShowBrowsersStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 ShowMiscStats=0 ShowHTTPErrorsStats=0 ShowSMTPErrorsStats=1 |
| $ sudo /usr/lib/cgi-bin/awstats.pl -config=postfix |
| 0,10,20,30,40,50 * * * * root /usr/lib/cgi-bin/awstats.pl -config=postfix -update >/dev/null |