allinurl / goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
https://goaccess.io
MIT License
18.01k stars 1.1k forks source link

nginx log format #20

Closed introfini closed 10 years ago

introfini commented 10 years ago

Hello!

I have tried everything but can't make it work with this nginx log format:

$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"

Example: 127.0.0.1 - - [23/Aug/2013:14:01:26 +0100] "GET /sites/xxx.pt/files/imagecache/64x64/avatar/picture-156409.jpg HTTP/1.1" 200 1768 "http://xxx.pt/forum/pr-saldos-80" "Mozilla/5.0 (Windows NT 5.1; rv:22.0; Avant TriCore) Gecko/20130630 Firefox/22.0" "213.58.193.194, 213.58.193.194"

I'm using version 0.6. I need the %h to be the http_x_forwarded_for

Thanks!

allinurl commented 10 years ago

@introfini: assuming %h is going to be the last IP, then you can use:

%^[%d:%^] "%r" %s %b "%R" "%u" "%^ %h"

otherwise:

%^[%d:%^] "%r" %s %b "%R" "%u" "%h,%^"
introfini commented 10 years ago

@allinurl thanks for helping!

None of them worked initially and that made very suspicious that it should be something else. I emptied the file and it start working! So I think it was some strange character that prevented parsing.

Thanks again!

gxhllj commented 8 years ago

Have you solved this problem ? I have the same problem. @introfini

allinurl commented 8 years ago

@gxhllj are you having issues with the log format?

gxhllj commented 8 years ago

yes, and i have replied you in another issues. maybe i need email you. @allinurl