GoAccess日志分析工具

简介: 1.1 GoAccess简介GoAccess是一个非常良心的开源软件,它的良心之处体现在如下方面:1)安装简单;2)操作容易;3)界面酷炫;GoAccess 官网 https://goaccess.

1.1 GoAccess简介

GoAccess是一个非常良心的开源软件,它的良心之处体现在如下方面:
1)安装简单;
2)操作容易;
3)界面酷炫;
GoAccess 官网 https://goaccess.io

图片.png | center | 730x523.5059760956176

1.2 安装GoAccess

1.2.1 系统环境说明

[root@clsn.io /root]
#cat  /etc/redhat-release
CentOS release 6.8 (Final)

[root@clsn.io /root] 
#uname  -a
Linux clsn.io 4.10.5-1.el6.elrepo.x86_64 #1 SMP Wed Mar 22 14:55:33 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@clsn.io /root] 
#sestatus
SELinux status:                 disabled

1.2.2 安装GoAccess

官网提供多种系统版本的安装方法: https://goaccess.io/download#installation

$ wget https://tar.goaccess.io/goaccess-1.3.tar.gz
$ tar -xzvf goaccess-1.3.tar.gz
$ cd goaccess-1.3/
$ ./configure --enable-utf8 --enable-geoip=legacy
$ make
# make install

配置完成的信息

Your build configuration:

  Prefix         : /usr/local
  Package        : goaccess
  Version        : 1.3
  Compiler flags :  -pthread
  Linker flags   : -lnsl -lncursesw -lGeoIP -lpthread
  Dynamic buffer : no
  Geolocation    : GeoIP Legacy
  Storage method : In-memory Hash Database (Default)
  TLS/SSL        : no
  Bugs           : goaccess@prosoftcorp.com

1.2.3 使用GoAccess分析日志

注:本次分析日志为 nignx 标准输出日志

[root@clsn.io /var/log/nginx] clsn.io Blog WebSite
#goaccess  -f  clsn.io.log

日志格式选为 NCSA Combined Log Format

图片.png | center | 730x511.6914749661705

 回车即可看到当前日志分析结果 

图片.png | center | 730x523.5059760956176

1.3 生成HTML页面

1.3.1 修改配置

查看当前配置

[root@clsn.io /usr/local/etc/goaccess] clsn.io Blog WebSite
#egrep  -v "^#|^$" goaccess.conf
config-dialog false
hl-header true
json-pretty-print false
no-color false
no-column-names false
no-csv-summary false
no-progress false
no-tab-scroll false
with-mouse false
agent-list false
with-output-resolver false
http-method yes
http-protocol yes
no-query-string false
no-term-resolver false
444-as-404 false
4xx-to-unique-count false
all-static-files false
double-decode false
ignore-crawlers false
crawlers-only false
ignore-panel REFERRERS
ignore-panel KEYPHRASES
real-os true
static-file .css
static-file .js
static-file .jpg
static-file .png
static-file .gif
static-file .ico
static-file .jpeg
static-file .pdf
static-file .csv
static-file .mpeg
static-file .mpg
static-file .swf
static-file .woff
static-file .woff2
static-file .xls
static-file .xlsx
static-file .doc
static-file .docx
static-file .ppt
static-file .pptx
static-file .txt
static-file .zip
static-file .ogg
static-file .mp3
static-file .mp4
static-file .exe
static-file .iso
static-file .gz
static-file .rar
static-file .svg
static-file .bmp
static-file .tar
static-file .tgz
static-file .tiff
static-file .tif
static-file .ttf
static-file .flv

由上可见默认配置中并无时间参数,需要在配置中添加时间参数。

[root@clsn.io /usr/local/etc/goaccess] clsn.io Blog WebSite
#cat  >>goaccess.conf<<EOF
> time-format %H:%M:%S
> date-format %d/%b/%Y
> #NCSA Combined Log Format
> log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
> EOF

[root@clsn.io /usr/local/etc/goaccess] clsn.io Blog WebSite
#cp -a goaccess.conf ../

1.3.2 添加定时任务

30 * * * *  /usr/local/bin/goaccess  /var/log/nginx/clsn.io.log* -o /www/wwwroot/monitor/report.html -p /usr/
local/etc/goaccess/goaccess.conf

1.3.3 检查生产页面
https://monitor.clsn.io/report.html

图片.png | center | 730x407.58333333333337

1.4 参考文献

https://www.linuxidc.com/Linux/2016-12/138731.htm
https://goaccess.io/man
https://goaccess.io/
https://www.imydl.tech/lnmp/197.html
https://segmentfault.com/a/1190000011025155

作者: 惨绿少年
出处: http://clsn.io
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
3月前
|
存储 Prometheus 监控
Prometheus vs. ELK Stack:容器监控与日志管理工具的较量
随着容器化技术的广泛应用,容器监控与日志管理成为了关键任务。本文将对两种常用工具进行比较与选择,分别是Prometheus和ELK Stack。Prometheus是一款开源的监控系统,专注于时序数据的收集和告警。而ELK Stack则是一套完整的日志管理解决方案,由Elasticsearch、Logstash和Kibana三个组件组成。通过比较它们的特点、优势和适用场景,读者可以更好地了解如何选择适合自己需求的工具。
|
4月前
|
监控 安全 NoSQL
5 个适用于 Linux 的开源日志监控和管理工具
5 个适用于 Linux 的开源日志监控和管理工具
282 0
|
7天前
工具变量法(两阶段最小二乘法2SLS)线性模型分析人均食品消费时间序列数据和回归诊断2
工具变量法(两阶段最小二乘法2SLS)线性模型分析人均食品消费时间序列数据和回归诊断
13 0
|
7天前
|
机器学习/深度学习 前端开发 数据挖掘
R语言计量经济学:工具变量法(两阶段最小二乘法2SLS)线性模型分析人均食品消费时间序列数据和回归诊断
R语言计量经济学:工具变量法(两阶段最小二乘法2SLS)线性模型分析人均食品消费时间序列数据和回归诊断
38 0
|
5月前
|
存储 数据可视化 搜索推荐
分布式系列教程(26) -分布式日志搜集工具Elasticsearch简介
分布式系列教程(26) -分布式日志搜集工具Elasticsearch简介
57 0
|
3月前
|
Prometheus 监控 Cloud Native
Prometheus VS ELK Stack:容器监控与日志管理工具的比较与选择
在容器化时代,有效的容器监控与日志管理工具对于确保应用程序的可靠性和可维护性至关重要。本文将比较两个主流工具,Prometheus和ELK Stack,探讨它们在容器监控和日志管理方面的特点、优势和适用场景,帮助读者做出明智的选择。
|
3月前
|
存储 监控 Ubuntu
日志切割工具-Logrotate实现nginx日志切割
日志切割工具-Logrotate实现nginx日志切割
40 0
|
5月前
一个查看 SAP CRM One Order 运行时生成的应用日志(Application Log)的小工具
一个查看 SAP CRM One Order 运行时生成的应用日志(Application Log)的小工具
61 0
|
5月前
|
监控 Java
JVM日志分析及工具
JVM日志分析及工具
48 0
|
9月前
|
存储 监控 Ubuntu
日志切割工具-Logrotate实现nginx日志切割
日志切割工具-Logrotate实现nginx日志切割
161 0

热门文章

最新文章