从零编写日志分析系统之nginx日志配置
来源:互联网 发布:c语言单链表的创建 编辑:程序博客网 时间:2024/06/05 13:53
配置nginx日志文件
nginx原有的配置文件包含的信息比较少,可以修改nginx.conf得到更多的数据。
nginx日志文件输出形式有三种形式,最常见的就是通过空格区分字段输出。还有通过自定义json形式输出,通过syslog直接输出到远端服务。
- 通过空格区分输出
log_format main '$remote_addr $remote_user [$time_local] "$request" $http_host ' '$status $upstream_status $body_bytes_sent "$http_referer"' '"$http_user_agent” $ssl_protocol $ssl_cipher $upstream_addr ' '$request_time $upstream_response_time';
- 通过自定义json输出
- log_format json '{"@timestamp":"$time_iso8601",''"host":"$server_addr",''"clientip":"$remote_addr",''"size":$body_bytes_sent,''"responsetime":$request_time,''"upstreamtime":"$upstream_response_time",''"upstreamhost":"$upstream_addr",''"http_host":"$host",''"url":"$uri",''"xff":"$http_x_forwarded_for",''"referer":"$http_referer",''"agent":"$http_user_agent",''"status":"$status"}';
- 发送到远端服务
- access_log syslog:server=unix:/data0/rsyslog/nginx.sock locallog;
- 发送到logstarsh
access_log syslog:server=192.168.0.2:5140,facility=local6,tag=nginx_access,severity=info logstashlog;
附录:nginx日志参数说明
参考:ELK stack中文指南
阅读全文
0 0
- 从零编写日志分析系统之nginx日志配置
- 从零编写日志分析系统之filebeat安装配置
- 从零编写日志分析系统之需求分析
- 从零编写日志分析系统之linux用户创建
- 从零编写日志分析系统之logstash
- 从零编写日志分析系统之elasticsearch5.5.2环境搭建
- nginx安全日志分析脚本的编写
- ELK+docker+nginx日志分析系统
- Nginx 日志分析 AWStats + JAWStats 安装配置
- nginx access 日志分析及配置
- nginx之基础命令(日志分析)
- Nginx之日志管理配置-yellowcong
- awk分析nginx日志
- nginx错误日志分析
- Linux Nginx日志分析
- awstats分析nginx日志
- nginx 日志分析
- nginx分析日志
- 错误 libpam enabled but missing——编译openVPN时出错
- java代码注释规范
- 使用AppCompat项目模版
- java web学习总结28:JSTL标签库之核心标签
- LRC检验码算法
- 从零编写日志分析系统之nginx日志配置
- 【机器学习-西瓜书】八、Bagging;随机森林(RF)
- 微服务架构的基础框架选择:Spring Cloud还是Dubbo?
- 为什么做作业批量调度的很多人都使用TASKCTL
- pat 乙级 1025. 反转链表 (25)
- PHP命名规则
- Win7环境如何快速搭建开发虚拟币交易平台
- 花都车险服务最好,最专业的是谁?
- WebService学习总结(三)——使用JDK开发WebService