原文地址
https://blog.51cto.com/13444271/2167514
安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| yum install glib2 glib2-devel GeoIP-devel ncurses-devel zlib zlib-develyum install gcc -y yum -y install GeoIP-update yum install goaccess
#修改/etc/nginx/nginx.conf文件的日志存储格式 log_format main '$remote_addr - $remote_user [$time_local] requesthost:"$http_host"; "$request" requesttime:"$request_time"; ' '$status $body_bytes_sent "$http_referer" - $request_body' '"$http_user_agent" "$http_x_forwarded_for"';
#修改文件/etc/goaccess.conf改成goaccess格式标准对应为 time-format %T date-format %d/%b/%Y log-format %h - %^ [%d:%t %^] requesthost:"%v"; "%r" requesttime:"%T"; %s %b "%R" - %^"%u"
#测试生成页面 goaccess -f /var/log/nginx/access.log -c -a>/usr/share/nginx/html/go.html
|
控制台
1
| goaccess /data/wwwlogs/access_all.log
|
页面展示
1
| goaccess /data/wwwlogs/access_all.log -c -a>/data/wwwroot/test.iguojin.com/log/index.html
|