[thelist] more fun with AWStats and Apache logs
Eduardo Kienetz
eduardok at gmail.com
Thu Jun 12 14:40:36 CDT 2008
On Thu, Jun 12, 2008 at 2:30 PM, John DeStefano
<john.destefano at gmail.com> wrote:
> So I'm trying to configure a server to use AWStats, and almost
> everything is fine (thanks Eduardo!), except for one set of fields in
> the Apache logs: the request (%r) and status (%s) fields. The default
> setting for Apache is '%r %>s', which returns the request and the
> *last* status code. So far, no combination of log formats for AWStats
> (1,4, or 'custom') and Apache I've tried has worked.
>
> Using Apache's default format for 'common' logging:
> LogFormat "%h %l %u %t \"%r\" %>s %b" common
> ... and AWStats's 'common' logging fails, because for some reason,
> Apache doesn't log the status for root '/' requests:
> mysite.com - - [12/Jun/2008:14:57:39 -0400] "GET /" 20056
>
> So I tried a custom format for AWStats:
> LogFormat %host %other %logname %time1 %methodurlnoprot %code %bytesd
> ... but this breaks with Apache log entries for anything other than a
> root request, such as:
> mysite.com - - [12/Jun/2008:14:52:46 -0400] "GET /my/path HTTP/1.0"
> 200 20056
>
> So I removed the status code from Apache's log format:
> LogFormat "%h %l %u %t \"%r\" %b" common
> ... and from AWStats:
> LogFormat %host %other %logname %time1 %methodurlnoprot %bytesd
> ... which breaks AWStats, because AWStats *requires* a 'code'.
>
>
> What else can I try, aside from some aspirin? What a headache. :/
Try:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
And make sure your VirtualHost is using Combined, e.g.:
CustomLog /var/log/apache/domain-access_log combined
--
Eduardo Bacchi Kienetz
http://www.kienetz.com
More information about the thelist
mailing list