AWStats †apache ¤Î¥¢¥¯¥»¥¹²òÀÏ¥½¥Õ¥È AWStats¤Ï¡¢httpd¤Î¥¢¥¯¥»¥¹¥í¥°¤ò²òÀϤ·¡¢»ë³ÐŪ¤Ë¥Ö¥é¥¦¥¶¤Ç±ÜÍ÷¤¹¤ë¤³¤È¤¬½ÐÍè¤ë·Á¤ËÀ°·Á¤¹¤ëPerl¤Î¥¹¥¯¥ê¥×¥È ¡¡Ëܲȥµ¥¤¥È¡¡http://awstats.sourceforge.net/ ¡¡´°Á´ÆüËܸìÈÇ¡¡http://www.bflets.dyndns.org/Tools/AWStatsJpn.html ¡¡´°Á´ÆüËܸìÈÇ¡¡http://www.starplatinum.jp/awstats/awstats66/ ¡¡´°Á´ÆüËܸìÈÇ¡¡http://www.starplatinum.jp/awstats/awstats70/ ¡¡ËܲȡÖAWStats¡×¤âVer.4.0¤«¤éÀµ¼°¤ËÆüËܸì¤ËÂбþ¤·¤¿¤³¤È¤Ë¤Ê¤Ã¤Æ¤ë¤¬¡¢Èó¾ï¤Ë¤ªÁÆËö¡£ »öÁ°½àÈ÷ †Jcode.pm ¤Î¥¤¥ó¥¹¥È¡¼¥ë †¡¡¥ª¥ê¥¸¥Ê¥ë¥í¥°Æâ¤ÎURL¤ò¥Ç¥³¡¼¥É¤¹¤ë¤¿¤á¤ËɬÍ× ¡¡»²¾È ¡¡¡ÖJcode-0.xx.tar.gz¡×¤ò¥À¥¦¥ó¥í¡¼¥É ¡¡¥¤¥ó¥¹¥È¡¼¥ë # tar zxvf Jcode-0.88.tar.gz # cd Jcode-0.88 # perl Makefile.PL; make; make install Can't locate ExtUtils/MakeMaker.pm ¤Ê¤É¤ÈÅܤé¤ì¤¿¤é # yum install perl-ExtUtils-MakeMaker ¡¡³Îǧ # perl -MJcode -e'print $Jcode::VERSION' 0.88 ¡¡ºï½ü # rm -rf Jcode-0.88 # rm -f Jcode-0.88.tar.gz nkf¥¤¥ó¥¹¥È¡¼¥ë †¡¡¡Önkf207.tar.gz¡×¤ò¥À¥¦¥ó¥í¡¼¥É ¡¡¥¤¥ó¥¹¥È¡¼¥ë # yum install nkf OR # tar zxvf nkf207.tar.gz # cd nkf207 # make # cp nkf /usr/bin/ ¡¡ºï½ü # rm -rf nkf207 # rm -f nkf207.tar.gz ¥ï¡¼¥à¤¬»Ä¤¹¥í¥°¤Ë¤è¤ëAWStats¤Î¥¨¥é¡¼²óÈò †AWStats¤Ê¤É¤Ç¥¢¥¯¥»¥¹¥í¥°¤ò¸µ¤ËÅý·×¾ðÊó¤ò½ÐÎϤ·¤Æ¤¤¤ë¾ì¹ç¡¢ ´Ä¶³Îǧ †
AWStats 6.5´°Á´ÆüËܸìÈÇ¡¡¥¤¥ó¥¹¥È¡¼¥ë †¡¡»²¹Í
¥¤¥ó¥¹¥È¡¼¥ë †¥Ç¥£¥ì¥¯¥È¥ê¤ÎºîÀ® // AWStats¥¤¥ó¥¹¥È¡¼¥ë¥Ç¥£¥ì¥¯¥È¥ê # mkdir /usr/local/apache2/cgi-bin/awstats // ¥í¥°¥Ç¥£¥ì¥¯¥È¥ê # mkdir /usr/local/apache2/cgi-bin/awstats/logs // ¥Ç¡¼¥¿¥Ç¥£¥ì¥¯¥È¥ê # mkdir /usr/local/apache2/cgi-bin/awstats/data // ¥¤¥á¡¼¥¸¥Õ¥¡¥¤¥ë¥Ç¥£¥ì¥¯¥È¥ê # mkdir -p /usr/local/apache2/htdocs/images/awstats ¥¤¥ó¥¹¥È¡¼¥ë # tar zxvf AWStats65_Jpn.tar.gz # cd AWStats65_Jpn # cd /usr/local/src/AWStats65_Jpn/wwwroot/ # cp -rf cgi-bin/* /usr/local/apache2/cgi-bin/awstats/ # cp -rf icon/* /usr/local/apache2/htdocs/images/awstats/ ÀßÄê †# cd /usr/local/apache2/cgi-bin/awstats/ # nkf -ed awstats.model_jp.conf > awstats.www.hoge.jp.conf # vi awstats.www.hoge.jp.conf awstats.www.hoge.jp.conf LogFile="/usr/local/apache2/cgi-bin/awstats/logs/www.hoge.jp-access_log.utf8" SiteDomain="www.hoge.jp" HostAliases="localhost 127.0.0.1 REGEX[hoge\.jp$]" DNSLookup=1 DirData="/usr/local/apache2/cgi-bin/awstats/data" DirCgi="/cgi-bin/awstats" DirIcons="/images/awstats" DetailedReportsOnNewWindows=0 SkipHosts="REGEX[^192\.168\.0\.]" # ÆÃÄê¤Î¥Û¥¹¥È¤ò½ü¤¯ SkipFiles="REGEX[^\/program.php]" # ÆÃÄê¤Î¥Õ¥¡¥¤¥ë¤ò½ü¤¯ ¼êÆ°¤Ç¼Â¹Ô †¥í¥°¥Õ¥¡¥¤¥ëºîÀ® # /usr/local/apache2/cgi-bin/awstats/utf8_decode.pl ¡¡</usr/local/apache2/logs/www.hoge.jp-access_log > /usr/local/apache2/cgi-bin/awstats/logs/www.hoge.jp-access_log.utf8 ¥¢¥¯¥»¥¹²òÀÏ¼Â¹Ô # cd /usr/local/apache2/cgi-bin/awstats # ./awstats.pl -config=www.hoge.jp -update Àµ¾ï¤Ë½ªÎ»¤·¤Æ¤¤¤ì¤Ð¡¢½èÍý·ë²Ì¤¬°Ê²¼¤Î¤è¤¦¤Ê·Á¤Çɽ¼¨¤µ¤ì¤Þ¤¹¡£ Lines in file: 225730 Found 5 dropped records, Found 124 corrupted records, Found 0 old records, Found 225601 new records. ²èÁü¤òɽ¼¨¤Ç¤¤ë¤è¤¦ httpd.conf ¤Ë²¼µ¤òÄɵ # vi /usr/local/apache2/conf/httpd.conf Alias /images/awstats/ "/usr/local/apache2/htdocs/images/awstats/" ¥Ö¥é¥¦¥¶¤Ç¥¢¥¯¥»¥¹²òÀÏ¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤·¤Æ¤ß¤ë ¡¡http://www.hoge.jp/awstats/ Äê´üŪ¤Ë¼Â¹Ô †# cd /usr/local/src/AWStats65_Jpn/ # nkf -ed awstats.cron > /usr/local/apache2/cgi-bin/awstats/awstats.cron awstats.cron #! /usr/bin/perl # ´°Á´ÆüËܸìÈÇAWStatsÍÑ¥µ¥ó¥×¥ëcron¥Õ¥¡¥¤¥ë # # ¥Õ¥¡¥¤¥ë¥Ñ¥¹Åù¤Ï¼«Ê¬¤Î´Ä¶¤Ë¹ç¤ï¤»¤Æ½ñ¤Ä¾¤·¤Æ²¼¤µ¤¤¡£ # http¤Î¥í¥°¥Õ¥¡¥¤¥ë¤ò¥Ç¥³¡¼¥É¤·¤¿¾å¤Ç°ì»þ¥Ç¥£¥ì¥¯¥È¥ê¤Ë³ÊǼ¤·¤Þ¤¹¡£ # access_log.utf8¤Ï°ì»þŪ¤Ë¥Ç¥³¡¼¥É¤·¤¿¥í¥°¤òÊݸ¤¹¤ë¥Õ¥¡¥¤¥ë¤Î̾Á°¤Ç¤¹¡£ system("/usr/local/apache2/cgi-bin/awstats/utf8_decode.pl < /usr/local/apache2/logs/www.hoge.jp-access_log > /usr/local/apache2/cgi-bin/awstats/logs/www.hoge.jp-access_log.utf8"); # ¥í¥°¥Õ¥¡¥¤¥ë¤¬Ê£¿ô¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¿ô¤Îʬ¹Ô¤¦ #system("/usr/local/apache2/cgi-bin/awstats/utf8_decode.pl < /usr/local/apache2/logs/www.hoge.jp-ssl_access_log > #/usr/local/apache2/cgi-bin/awstats/logs/www.hoge.jp-access_log.utf8"); # awstats.pl¤¬ÀÚ¤êµÍ¤á¤Ê¤¤¥ª¥ê¥¸¥Ê¥ë¤Î¥í¥°¤òÀÚ¤êµÍ¤á¤Þ¤¹¡£ #open(LOG,"+</usr/local/apache2/logs/www.hoge.jp-access_log"); #truncate(LOG,0); #close(LOG); #open(LOG,"+</usr/local/apache2/logs/www.hoge.jp-ssl_access_log"); #truncate(LOG,0); #close(LOG); # Ver.5.0¤«¤é¡¢¹¹¿·½èÍý¤òÊÌÅÓÁö¤é¤»¤ëɬÍפ¬¤Ç¤¤¿¤é¤·¤¤.... system("/usr/local/apache2/cgi-bin/awstats/awstats.pl -config=www.hoge.jp -update > /dev/null"); # awstats.pl¤òÁö¤é¤»¡¢html¥Õ¥¡¥¤¥ë¤ò½ÐÎϤ·¤Þ¤¹¡£ # ɬ¿Ü¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢awstats.pl¤òľÀÜ»²¾È¤µ¤»¤ë¤è¤ê¤â¡¢html¤Ë½ÐÎϤ·¤Æɽ¼¨¤¹ # ¤ëÊý¤¬¡¢Îɹ¥¤Ê¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤¬ÆÀ¤é¤ì¤Þ¤¹¡£ #system("/usr/local/apache2/cgi-bin/awstats/awstats.pl -config=www.hoge.jp -output -staticlink > /home/hoge/public_html/awstats/index.html"); # ¥¢¥¯¥»¥¹²Äǽ¤Ë¤Ê¤ë¤è¤¦¤Ë½ÐÎϤ·¤¿html¥Õ¥¡¥¤¥ë¤Î¸¢¸Â¤òÊѹ¹ #system("chgrp hoge /home/hoge/public_html/awstats/index.html"); #system("chown hoge /home/hoge/public_html/awstats/index.html"); ¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤òÊѹ¹ # chmod 700 /usr/local/apache2/cgi-bin/awstats/awstats.cron cron ¤Ç¤³¤Î¥¹¥¯¥ê¥×¥È¤ò¼«Æ°¼Â¹Ô ¡ÊÎã¤Ç¤Ï30ʬËè¤Ë¼Â¹Ô¡Ë # crontab -e 30 * * * * perl /usr/local/apache2/cgi-bin/awstats/awstats.cron AWStats¤Èlogrotate¤ÎÌäÂêÅÀ²ò·è †Apache¤Îaccess_log¤òlogrotate¤Ë¤è¤ê¥í¡¼¥Æ¡¼¥·¥ç¥ó¤·¤Æ¤¤¤ë¾ì¹ç¤ËÌäÂ꤬ȯÀ¸¤¹¤ë¡£ Î㤨¤Ð4»þ10ʬ¤Ëaccess_log¤Î ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥ó¤¬¹Ô¤ï¤ì¤ë¤È¤¹¤ë¤È ¤³¤ÎÌäÂê¤ò²ò·è¤¹¤ë¤Ë¤Ïaccess_log¤ò¥í¡¼¥Æ¡¼¥·¥ç¥ó¤¹¤ëľÁ°¤Ëawstats.pl¤Ë¤è¤êÅý·×¾ðÊó¤ò¥¢¥Ã¥×¥Ç¡¼¥È¤·¤Þ¤¹¡£ /etc/logrotate.d/apache¤òÊÔ½¸¤·¤Þ¤¹¡£ # vi /etc/logrotate.d/apache ²¼µ¤òapacheºÆµ¯Æ°¤ÎÁ°¤ËÄɲà prerotate perl /usr/local/apache2/cgi-bin/awstats/awstats.cron endscript "/usr/local/apache2/logs/*_log" { rotate 4 compress weekly sharedscripts prerotate perl /usr/local/apache2/cgi-bin/awstats/awstats.cron endscript postrotate /usr/local/apache2/bin/apachectl restart endscript } ÀÅŪHTML½ÐÎÏ †cgi¤¬½Å¤¤¤Î¤Ç¤¢¤ì¤ÐHTML½ÐÎÏ¡£ ¼êÆ°¼Â¹Ô # ./awstats.pl -config=www.hoge.jp -output -staticlink > /home/hoge/public_html/awstats/index.html ¥¯¥í¡¼¥ó¤ÇÆ°¤«¤¹¾ì¹ç¤Ïawstats.cron¤ËÄɵ # awstats.pl¤òÁö¤é¤»¡¢html¥Õ¥¡¥¤¥ë¤ò½ÐÎϤ·¤Þ¤¹¡£ # ɬ¿Ü¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢awstats.pl¤òľÀÜ»²¾È¤µ¤»¤ë¤è¤ê¤â¡¢html¤Ë½ÐÎϤ·¤Æɽ¼¨¤¹ # ¤ëÊý¤¬¡¢Îɹ¥¤Ê¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤¬ÆÀ¤é¤ì¤Þ¤¹¡£ system("/usr/local/apache2/cgi-bin/awstats/awstats.pl -config=www.hoge.jp -output -staticlink > /home/hoge/public_html/awstats/index.html"); # ¥¢¥¯¥»¥¹²Äǽ¤Ë¤Ê¤ë¤è¤¦¤Ë½ÐÎϤ·¤¿html¥Õ¥¡¥¤¥ë¤Î¸¢¸Â¤òÊѹ¹ system("chgrp hoge /home/hoge/public_html/awstats/index.html"); system("chown hoge /home/hoge/public_html/awstats/index.html"); |