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

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

20200103193054943.png

官网说明

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

924f86d1b5764e8bbac416ce368bff70.png


access_log

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

Syntax: log_format name [escape=default|json|none] string ...;
Default:  
log_format combined "...";
Context:  http


open_log_file_cache

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

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;


67aa26df59c9499299281de9e0eaa564.png

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


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


https://goaccess.io/

https://goaccess.io/get-started

第一步

[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

第二步

a29d5efd0d9d422cb4cc5e3f76600624.png


第三部

e835e51bce7044dd90302e62ee88fff9.png


9e111f812da946e68a4d179edfad21fa.png


相关实践学习
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
相关文章
|
9月前
|
监控 安全 程序员
Python日志模块配置:从print到logging的优雅升级指南
从 `print` 到 `logging` 是 Python 开发的必经之路。`print` 调试简单却难维护,日志混乱、无法分级、缺乏上下文;而 `logging` 支持级别控制、多输出、结构化记录,助力项目可维护性升级。本文详解痛点、优势、迁移方案与最佳实践,助你构建专业日志系统,让程序“有记忆”。
794 0
|
数据可视化 关系型数据库 MySQL
ELK实现nginx、mysql、http的日志可视化实验
通过本文的步骤,你可以成功配置ELK(Elasticsearch, Logstash, Kibana)来实现nginx、mysql和http日志的可视化。通过Kibana,你可以直观地查看和分析日志数据,从而更好地监控和管理系统。希望这些步骤能帮助你在实际项目中有效地利用ELK来处理日志数据。
1001 90
|
监控 应用服务中间件 定位技术
要统计Nginx的客户端IP,可以通过分析Nginx的访问日志文件来实现
要统计Nginx的客户端IP,可以通过分析Nginx的访问日志文件来实现
1574 3
|
Prometheus Cloud Native Go
Golang语言之Prometheus的日志模块使用案例
这篇文章是关于如何在Golang语言项目中使用Prometheus的日志模块的案例,包括源代码编写、编译和测试步骤。
388 4
Golang语言之Prometheus的日志模块使用案例
|
应用服务中间件 nginx
nginx error日志 client intended to send too large body: 1434541 bytes 如何处理?
【8月更文挑战第27天】nginx error日志 client intended to send too large body: 1434541 bytes 如何处理?
1153 6
|
Go 开发者
【应用服务 App Service】App Service发生错误请求时,如何查看IIS Freb日志,从中得知错误所发生的模块,请求中所携带的Header信息
【应用服务 App Service】App Service发生错误请求时,如何查看IIS Freb日志,从中得知错误所发生的模块,请求中所携带的Header信息
316 2
|
应用服务中间件 Linux nginx
在Linux中,如何统计ip访问情况?分析 nginx 访问日志?如何找出访问页面数量在前十位的ip?
在Linux中,如何统计ip访问情况?分析 nginx 访问日志?如何找出访问页面数量在前十位的ip?
|
数据挖掘 语音技术
3D-Speaker说话人任务的开源项目问题之语义说话人信息模块在说话人日志系统中的问题如何解决
3D-Speaker说话人任务的开源项目问题之语义说话人信息模块在说话人日志系统中的问题如何解决
302 1
|
存储 监控 应用服务中间件
查看nginx日志文件
器性能和提高网站可用性。掌握日志文件的路径、查看方法和基本分析技能对于任何服务器管理员来说都是必备技能。
2031 1
|
Shell Python
salt自定义模块内使用日志例子
salt自定义模块内使用日志例子

热门文章

最新文章