一个不错的nginx日志文件分析软件,命令行工具goaccess
官网下载地址:https://goaccess.io/download
用法(配置)参考:https://blog.csdn.net/weixin_43860781/article/details/104668332
使用命令:
goaccess tell520_20220709.log使用这个命令,后会显示一个配置窗口,一般选择第一个格式就好了,如果有自己修改过日志格式,简单修改一下log-format格式即可
使用docker镜像分析日志文件
#单/多个文件
cat www.log | docker run --rm -i -e LANG=zh_CN -e TZ="Asia/Shanghai" allinurl/goaccess -a -o html --log-format '%^: %h %^[%d:%t %^] "%r" %s %b "%R" "%u"' --date-format '%d/%b/%Y' --time-format '%H:%M:%S' - > ngx.html
#实时数据流
tail -F access.log | docker run -p 7890:7890 --rm -i -e LANG=zh_CN -e TZ="Asia/Shanghai" allinurl/goaccess -a -o html --log-format '%^: %h %^[%d:%t %^] "%r" %s %b "%R" "%u"' --date-format '%d/%b/%Y' --time-format '%H:%M:%S' --real-time-html - > ngx.html当前最新版本:1.6.1
#编译安装
$ wget https://tar.goaccess.io/goaccess-1.6.1.tar.gz
$ tar -xzvf goaccess-1.6.1.tar.gz
$ cd goaccess-1.6.1/
$ ./configure --enable-utf8 --enable-geoip=mmdb
$ make
# make install
#通过软件包管理工具安装
Fedora
# yum install goaccess
Arch Linux
# pacman -S goaccess
Gentoo
# emerge net-analyzer/goaccess
OS X / Homebrew
# brew install goaccess
#Note: If GeoIP is needed, append --with-libmaxminddb to the command above. You will need to download the City/Country database from MaxMind and use the option --geoip-database to specify the database.
FreeBSD
# pkg install sysutils/goaccess
OpenBSD
# pkg_add goaccess
OpenSUSE
# zypper ar -f obs://server:http http
# zypper in goaccess
pkgsrc (NetBSD, Solaris, SmartOS, ...)
# pkgin install goaccess
Slackware
# curl https://slackbuilds.org/slackbuilds/14.1/system/goaccess.tar.gz | tar xvz
# cd goaccess/
# GEOIP=yes ./goaccess.SlackBuild
参数配置说明:
GoAccess 中文站:https://www.goaccess.cc/?mod=man
GoAccess 官方:https://goaccess.io/man
版权属于:Joyber
本文链接:https://blog.qqvbc.com/default/596.html
转载时须注明出处及本声明