nginx 1.4.7 发送日志到rsyslog

<pre name="code" class="html">tar -xzf nginx-1.4.7.tar.gz
# cd nginx-1.4.77
# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx \
--with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module \
--with-pcre=/root/pcre-8.36 --with-http_realip_module 


front-end:/root/nginx-1.4.7# patch -p1 </root/nginx_syslog_patch/syslog_1.4.0.patch 
patching file src/core/ngx_cycle.c
patching file src/core/ngx_log.c
patching file src/core/ngx_log.h
patching file src/http/modules/ngx_http_log_module.c
patching file src/http/ngx_http_core_module.c
Hunk #2 succeeded at 4895 (offset 2 lines).
Hunk #3 succeeded at 4913 (offset 2 lines).
Hunk #4 succeeded at 4952 (offset 2 lines).
patching file src/http/ngx_http_request.c
Hunk #1 succeeded at 517 (offset -14 lines).
Hunk #2 succeeded at 798 (offset -23 lines).
Hunk #3 succeeded at 2002 (offset -23 lines).
front-end:/root/nginx-1.4.7# 


重新编译nginx:

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx \
--with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module \
--with-pcre=/root/pcre-8.36 --with-http_realip_module --add-module=/root/nginx_syslog_patch/


front-end:/root/nginx-1.4.7# nginx -V
nginx version: nginx/1.4.7
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre=/root/pcre-8.36 --with-

http_realip_module
front-end:/root/nginx-1.4.7# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.4.7
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre=/root/pcre-8.36 --with-

http_realip_module --add-module=/root/nginx_syslog_patch/


nginx 配置:

syslog local6 nginx;
   #send the log to syslog and file.
   access_log  syslog:notice|logs/access.log main;

   # pre 1.5.x
   error_log syslog:notice|logs/error.log;
   sendfile        on;
   tcp_nopush     on;






   

posted @ 2016-08-05 10:59  czcb  阅读(403)  评论(0编辑  收藏  举报