我是靠谱客的博主 自然鞋垫,最近开发中收集的这篇文章主要介绍nginx 通过rsyslog发日志 rsyslog服务器挂掉 日志丢失问题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

nginx 配置:
user  nginx;
worker_processes  1;
syslog local5 nginx-zjzc01;


rsyslog 服务器收到的消息:

-rw-r--r-- 1 root  root  190 Aug 10 16:08 aa.log
zjtest7-frontend:/tmp# cat aa.log 
Aug 10 16:10:02 jrhwpt01 nginx-zjzc01: www.zjcap.cn 10.252.105.157 10.171.246.184 [10/Aug/2016:16:10:02 +0800] "GET / HTTP/1.1" - 200 30873 "-" "LWP::Simple/5.827 libwww-perl/5.833" 0.005 -



测试:

nginx 端:

120.26.44.206:8001 120.26.44.206 120.55.118.6 [10/Aug/2016:16:21:13 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 

libidn/1.18 libssh2/1.4.2" 0.001 -






rsyslog 服务器端:

zjtest7-frontend:/rsyslog/data/nginx/zjzc# grep curl nginx_access0*2016-08-10
nginx_access01_log.2016-08-10: 120.26.44.206:8001 120.26.44.206 115.236.160.82 [10/Aug/2016:16:11:31 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 

NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.004 -


nginx_access01_log.2016-08-10: 120.26.44.206:8001 120.26.44.206 120.55.118.6 [10/Aug/2016:16:21:13 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 

NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.001 -


此时停止rsyslog服务器:

nginx 端:
120.26.44.206:8001 120.26.44.206 121.40.248.168 [10/Aug/2016:16:22:45 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 

libssh2/1.4.2" 0.001 -
^C


开启rsyslog



rsyslog端:

zjtest7-frontend:/rsyslog/data/nginx/zjzc# grep curl nginx_access0*2016-08-10
nginx_access01_log.2016-08-10: 120.26.44.206:8001 120.26.44.206 115.236.160.82 [10/Aug/2016:16:11:31 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 

NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.004 -

nginx_access01_log.2016-08-10: 120.26.44.206:8001 120.26.44.206 120.55.118.6 [10/Aug/2016:16:21:13 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 
N/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.001 -




zjtest7-frontend:/tmp# cat aa.log  | grep curl
Aug 10 16:11:31 jrhwpt01 nginx-zjzc01: 120.26.44.206:8001 120.26.44.206 115.236.160.82 [10/Aug/2016:16:11:31 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) 

libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.004 -

Aug 10 16:21:13 jrhwpt01 nginx-zjzc01: 120.26.44.206:8001 120.26.44.206 120.55.118.6 [10/Aug/2016:16:21:13 +0800] "GET / HTTP/1.1" - 200 30873 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) 

libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2" 0.001 -

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199399.html

最后

以上就是自然鞋垫为你收集整理的nginx 通过rsyslog发日志 rsyslog服务器挂掉 日志丢失问题的全部内容,希望文章能够帮你解决nginx 通过rsyslog发日志 rsyslog服务器挂掉 日志丢失问题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部