安装
yum install goaccess
启动
-
跳转到
nginx/logs
目录 -
使用命令将
report.html
输出到nginx/html
目录下-
实时版本
goaccess access.log -o ../html/report.html --log-format=COMBINED --real-time-html
-
静态版本
goaccess access.log -o ../html/report.html --log-format=COMBINED
-
-
配置
nginx.conf
http { server { listen 1234; location /report.html { alias html/report.html; } } }
-
最后打开
xx.xxx.xxx.xx:1234/report.html
就可以访问GoAccess
了
使用 crontabs 定时更新
-
编写更新
goaccess
的脚本#!/bin/bash goaccess /home/nginx/logs/access.log -o /home/nginx/html/report/index.html --log-format=COMBINED echo -e "update success"
-
yum install crontabs
安装crontabs
-
crontab -e
配置定时任务贴入以下配置,保存即可
0 0 * * * /common_shell/update_goaccess.sh
Linux/Mac Tutorial: Cron Jobs - How to Schedule Commands with crontab