首页 > 其他 > 详细

NGINX 日志处理 之六

时间:2018-07-16 18:28:04      阅读:173      评论:0      收藏:0      [点我收藏+]
1、定义NGINX错误日志
worker_processes  1;
events {
        worker_connections  1024;
}
error_log  logs/error.log;        #定义日志路径,默认级别为error,配置位置main体里
http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        include vhost/*.conf;
}

2、定义NGINX访问日志

worker_processes  1;
events {
        worker_connections  1024;
}
error_log  logs/error.log;
http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘     #只允许在http模块里配置,此格式为默认定义
                                            ‘$status $body_bytes_sent "$http_referer" ‘
                                            ‘"$http_user_agent" "$http_x_forwarded_for"‘;

        access_log  logs/access.log  main;     #日志存放路径与使用的格式

        include vhost/*.conf;
}

3、NGINX日志切割

请参考:http://ibm.chick.blog.163.com/blog/static/144201610201621135441819/

NGINX 日志处理 之六

原文:http://blog.51cto.com/12965094/2144995

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!