Forum: NGINX Proper LogFormat setting for AWstats for the default nginx log output?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6030abb7630e62ae157d85b933c00d4d?d=identicon&s=25 JW (Guest)
on 2009-01-01 01:14
(Received via mailing list)
Hello,

I have several days worth of Nginx logs that I need to run through
AWstats.

I tried leaving LogFormat=1 in the awstats config (which is correct for
the
default apache logs) but that doesn't work.

I search on the 'web but all the solutions I found require changing the
nginx
log_format directive first (too late now).

Does anyone know the correct AWStats LogFormat settings to process a log
produced by the default nginx config?

Thanks,

  JW

--
0964828011133c856bae646e55911115?d=identicon&s=25 William Ross (Guest)
on 2009-01-01 10:29
(Received via mailing list)
On 1 Jan 2009, at 00:00, JW wrote:

> Hello,
>
> I have several days worth of Nginx logs that I need to run through
> AWstats.
>
> I tried leaving LogFormat=1 in the awstats config (which is correct
> for the
> default apache logs) but that doesn't work.

If your logs are the same as mine then the problem is a double space
that nginx leaves in each log entry between the status code and the
bytes sent. I tried various ways of specifying the double space but
without success - it seems they collapse spaces in the logformat
settings line but not in the file itself - so I gave up and now just
run:

   perl -pi -e 's/  / /g' ./nginx.access.log

before an awstats run. With that, I can just use this configuration
line:

   LogFormat="%host %other %logname %time1 %methodurl %code %bytesd
%refererquot %uaquot %otherquot"

Which is the default with an added %otherquot for the final
http_x_forwarded_for that nginx adds by default.

I guess by specifying the log format in nginx I could eliminate the
problem, but like you I always come to it with a load of existing
logfiles to process.

best,

will
This topic is locked and can not be replied to.