安装
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.confhttp { 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