goaccess备忘

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了goaccess备忘相关的知识,希望对你有一定的参考价值。

安装支持组件yum install geoip-devel


$ wget http://tar.goaccess.io/goaccess-1.2.tar.gz

$ tar -xzvf goaccess-1.2.tar.gz

$ cd goaccess-1.2/

$ ./configure --enable-utf8 --enable-geoip=legacy

$ make

# make install

goaccess.conf后增加日志格式

time-format %T

date-format %d/%b/%Y

log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"


To generate an html report, just run it against your web log file: (-a is optional)

# goaccess /var/log/apache2/access.log -a -o report.html

OR

# zcat -f /var/log/apache2/access.log* | goaccess -a -o report.html


Just generate a static report and place the output html file under your web server www public folder. You need to add a couple of additional real-time flags. The use of --real-time-html is required.

# goaccess access.log -o /usr/share/nginx/www/rt.goaccess.io/report.html --real-time-html

Upon opening the generated report in your browser, the report will try to establish a WebSocket connection to the host name (window.location.hostname) where the generated report is running from.


Also, it is worth pointing out that if we want to run GoAccess at lower priority, we can run it as:

# nice -n 19 goaccess access.log -a

and if you don‘t want to install it on your server, you can still run it from your local machine:

# ssh  [email protected] ‘zcat /data/wwwlogs/nginx.log-2017*‘ | goaccess -a -o /data/wwwroot/Goaccess/report2017.html


以上是关于goaccess备忘的主要内容,如果未能解决你的问题,请参考以下文章

goaccess的安装和使用

goaccess 编译失败解决办法。

用GoAccess分析Nginx的日志

CentOS安装goaccess

用goaccess每天自动分析nginx日志

利用GoAccess图形化分析Nginx访问日志