このログ形式を読むにはどうすればよいですか?
-
30-09-2019 - |
質問
いくつかのサブドメインを備えたサイトがあり、すべてのサブドメインが同じAccess_logファイルにログに記録されます。ファイルは非常に巨大である可能性があるため、各サブドメインを独自のファイルにグレップするスクリプトがあります。
Apacheのカスタムログファイル形式があります。
"\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
私のログファイルからの行は次のようになります:
"brand.mysite.com" 176.32.1.18 - - [24/Oct/2010:11:24:45 -0400] "GET /Product/lookup HTTP/1.1" 200 5585 "http://www.customerhomepage.com/brand_name.htm" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 1.1.4322)"
ログ形式の10項目、ログ内の10項目。小切手。
AWSTATS構成ファイルに次のLogFormatを使用して、これらをAWSTATSで分析しようとしています。
logformat = ""%host_r "%host%logname%logname%time1%methodurl%code%bytesd%refererquot%uaquot"
AWSTATSから得られる唯一の出力は、毎月の歴史セクションからです。他のすべては空白またはゼロのいずれかです。
私の世代のスクリプトは次のようになります:
rm stats/*.txt
cat access_log | grep brand > brand_access_log
perl tools/awstats_updateall.pl -configdir=wwwroot/cgi-bin -awstatsprog=wwwroot/cgi-bin/awstats.pl now
perl tools/awstats_buildstaticpages.pl -dir=stats -output=pagetype -config=brand -awstatsprog=wwwroot/cgi-bin/awstats.pl
私は何が間違っているのですか?
解決
Apache logformatディレクティブをカットして貼り付けることができることに気づきませんでした(= signを使用して)。
Awstatsは、httpd.confファイルからlogformatディレクティブを使用し、awstats識別子に置き換えます。
私はこれをawstats.hapache2 httpd.confから直接直接カットして貼り付けました。
LogFormat="\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
所属していません StackOverflow