GoAccess实时日志监控

共709个字

本文章基于Ubuntu16.04系统/Nginx1.10.3日志环境
注:Nginx使用apt-get方式安装,日志格式为默认

源码安装
$ apt-get install gcc g++ libncursesw5-dev
$ wget http://tar.goaccess.io/goaccess-1.2.tar.gz
$ http://tar.goaccess.io/goaccess-1.2.tar.gz
$ tar -xzvf goaccess-1.2.tar.gz
$ cd goaccess-1.2/
$ ./configure –enable-utf8
$ make # make install

配置文件
vim ~/.goaccessrc
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] “%r” %s %b “%R” “%u”

任务设置
$ goaccess -f /var/log/nginx/access.log -p ~/.goaccessrc -a -o /var/www/index.html –real-time-html –daemonize

然而,他喵的不知道是出了什么问题,–daemonize生效了,但是 –real-time-html无法实时刷新。。坑爹了。

最后改用 crontab
$ vim /etc/crontab

*  *    * * *   root    goaccess -a -d -f /var/log/nginx/access.log -p /root/.goaccessrc -o /var/www/index.html

相关的目录请自行替换

更详细的内容请自行参考官网https://goaccess.io/

❤ 喜欢 9854

2条回应:“GoAccess实时日志监控”

  1. My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type on a variety of
    websites for about a year and am worried about switching to another platform.
    I have heard fantastic things about blogengine.net.
    Is there a way I can import all my wordpress posts into it?
    Any kind of help would be really appreciated!

  2. gamefly说道:

    What’s Going down i am new to this, I stumbled upon this I’ve discovered It
    absolutely useful and it has helped me out loads. I hope to contribute &
    assist different customers like its helped me.
    Good job.

发表评论

必填项已用*标注

归档于 Ubuntu