goaccess监控

现在监控工具很多,常用的有zabbix、nagios、云监控等,如果做性能分析,我比较推荐的是goaccess,它可以将日志文件生成html页面,以供我们分析。

操作步骤:
一、安装goaccess软件

$ yum -y install goaccess

二、在nginx中开启日志功能,并指定其格式

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$request_time" "$upstream_response_time" "$http_cookie" request_body&&&&&$request_body';

    access_log  logs/access.log  main;

三、goaccess服务的配置文件内容

time-format %T
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %^ "%T" %^ %^ %^

四、将nginx 的访问日志转化成html

命令:
/usr/bin/goaccess –config-file=goaccess配置文件名 -f nginx的日志文件 -a > html文件

例如:/usr/bin/goaccess –config-file=/usr/app/goaccessrc.txt -f /data/logs/nginx/access.log -a > access.html

这里写图片描述

生成的html文件:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/m0_37886429/article/details/81145205