문제

I have a site with several subdomains, all subdomains are logged to the same access_log file. Since the file can be so huge, I have a script that greps out each subdomain into its own file.

I have a custom log file format in Apache like so:

"\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

A line from my log file looks like this:

"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 items in the log format, 10 items in the log. Check.

I'm trying to analyze these with awstats with the following Logformat in my awstats config file:

LogFormat="\"%host_r\" %host %logname %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"

The only output I get from awstats is from the Monthly History section. Everything else is either blank or zero.

My generation script looks like this:

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

What am I doing wrong?

도움이 되었습니까?

해결책

I didn't realize I could just cut and paste the Apache LogFormat directive (with an = sign) and it would work, I thought I was forced to use awstats.

awstats will use the LogFormat directive from your httpd.conf file and replace it with the awstats identifiers.

I cut and pasted this into my awstats.whatever.conf file directly from my Apache2 httpd.conf (and then added the = sign after LogFormat):

LogFormat="\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top