nginx日志定制

    1. 进入nginx安装目录
      cd /usr/local/nginx/

    2.  vi nginx.conf

      log_format lvan '$remote_addr - $remote_user [$time_iso8601] "$request" $http_host '
      '$status $body_bytes_sent "$http_referer" '
      '"$http_user_agent" $http_x_forwarded_for '
      '"$upstream_addr" $upstream_status "$upstream_cache_status" "$upstream_http_content_type" $upstream_response_time "$request_time" $request_length $bytes_sent $server_name';


       
    3.  检查nginx状态
      /usr/local/nginx/sbin/nginx -t



    4. 重新加载nginx
      /usr/local/nginx/sbin/nginx -s reload
       

    5. 查看新的访问日志

       tail -100f  /var/log/nginx/mqpublish.iapi.ymatou.com.log

原文地址:https://www.cnblogs.com/chenjiazhu/p/7424993.html