I converted my nginx logformat to make sure I could keep using awstats to record my datatraffic etc. Since I needed to parse half a day of logging through Apache and then later through nginx, I needed to make sure the same formats where used. In Apache I configured the common logformat; which results in the following for nginx:
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
I also created a couple of include files so that standard stuff is included for every vhost, without it requiring me to denote everything (which is quite a lot if you do it properly).




English
Dutch
Hey Remko, thanks for this.
Did you have to set a special LOGFORMAT for this in analog.cfg or did it just work using the automatic (default) setting?
Thanks for posting this. Now I just hope I can salvage the 50,000 records I have in my old format!.. Haha!
Well, if you carefully look at your current format and my format, you might be able to use sed and awk (or perl) to modify the string so that it gets the proper fields replaced/inserted. This is how I managed to get my old nginx stats imported in awstats. Ofcourse I do not remember from head what I did, but I think all I needed to do is insert two ” ‘s…
Goodluck!