GoAccess分析Nginx/Apache/IIS日志

CentOS 下用 yum 安装

yum install -y epel-release
yum install -y GeoIP-devel ncurses-devel 
yum install -y goaccess

CowAxess - Windows 版 GoAccess

https://itefix.net/cowaxess

安装到 IIS 日志目录

goaccess -f W3SVC*/*.log --log-format=W3C -a -o all_log.html

浏览器访问 http://9duw.com/log.html

附上各个平台依赖包列表

ubuntu 包管理器安装

使用 GoAccess 源码编译安装

编译安装之前需要安装 geoip 依赖开发包

GoAccess 分析宝塔 nginx 日志文件生成 HTML 页面

GoAccess 可以将日志分析报告生成静态 HTML 页面以供展示,在使用 GoAccess 生成 HTML 页面之前,需要修改 GoAccess 的配置文件来指定日志格式,注意日志的格式需要根据情况而定

使用 GoAccess 生成静态 HTML 页面

使用 GoAccess 生成的静态 HTML 页面如下

web

不识别的格式可使用 nginx2goaccess.sh 脚本将 nginx 日志格式格式化为 goaccess 能识别的日志格式

https://github.com/stockrt/nginx2goaccess

使用如下方法获取日志格式:

如:

会得到三个格式

将上述格式填写到 goaccessrc 文件中即可

  • 日志格式 COMBINED | Combined Log Format VCOMBINED | Combined Log Format with Virtual Host COMMON | Common Log Format VCOMMON | Common Log Format with Virtual Host W3C | W3C Extended Log File Format SQUID | Native Squid Log Format CLOUDFRONT | Amazon CloudFront Web Distribution CLOUDSTORAGE | Google Cloud Storage AWSELB | Amazon Elastic Load Balancing AWSS3 | Amazon Simple Storage Service (S3)

goaccess iis w3c 自定义log 格式参考

goaccess 支持强大的自定义log 格式,比如我们需要分析iis w3c 格式日志

参考IIS W3C | W3C Extended Log File Format

最后更新于