前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >重识Nginx - 10 ngx_http_log_module日志模块 & GoAccess日志分析

重识Nginx - 10 ngx_http_log_module日志模块 & GoAccess日志分析

作者头像
小小工匠
发布2022-10-04 17:27:11
1950
发布2022-10-04 17:27:11
举报
文章被收录于专栏:小工匠聊架构小工匠聊架构

文章目录

在这里插入图片描述
在这里插入图片描述

官网说明

https://nginx.org/en/docs/http/ngx_http_log_module.html

在这里插入图片描述
在这里插入图片描述

access_log

代码语言:javascript
复制
Syntax:	access_log path [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]];
access_log off;
Default:	
access_log logs/access.log combined;
Context:	http, server, location, if in location, limi

log_format

代码语言:javascript
复制
Syntax:	log_format name [escape=default|json|none] string ...;
Default:	
log_format combined "...";
Context:	http

open_log_file_cache

代码语言:javascript
复制
Syntax:	open_log_file_cache max=N [inactive=time] [min_uses=N] [valid=time];
open_log_file_cache off;
Default:	
open_log_file_cache off;
Context:	http, server, location
在这里插入图片描述
在这里插入图片描述

日志

Example Configuration

代码语言:javascript
复制
log_format compression '$remote_addr - $remote_user [$time_local] '
                       '"$request" $status $bytes_sent '
                       '"$http_referer" "$http_user_agent" "$gzip_ratio"';

access_log /spool/logs/nginx-access.log compression buffer=32k;
在这里插入图片描述
在这里插入图片描述

可以使用 https://nginx.org/en/docs/varindex.html 内置的变量。

在这里插入图片描述
在这里插入图片描述

GoAccess实现可视化并实时监控access日志

https://goaccess.io/

https://goaccess.io/get-started

第一步

代码语言:javascript
复制
[root@VM-0-7-centos ~]#  goaccess  access.log -o ../html/report.html
--real-time-html  --time-format='%H:%M:%s' --date-format='%d/%b/%Y' --log-format=COMBINED

Websocket server ready to accept new client connections

第二步

在这里插入图片描述
在这里插入图片描述

第三部

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-10-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 官网说明
    • access_log
      • log_format
        • open_log_file_cache
        • 日志
        • GoAccess实现可视化并实时监控access日志
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档