nginx 채집 post 요청 로그

문 제 를 해결 하 다
    1:     post        ,           ;

해결 방법:
    1:     openresty   nginx;
    2:      nginx    lua  ;

nginx 버 전:
nginx -v
nginx version: openresty/1.13.6.2

구성 사례
     
log_format post_format '$time_iso8601\t$remote_addr\t$http_user_agent\t$request\t$request_body\t$request_time\t$upstream_addr\t$upstream_response_time\t$http_x_forwarded_for';
vs   

server {
        listen       443;
        server_name  app.kjh.cn;
        ssl  on;
        ssl_certificate  /usr/local/openresty/ssl.crt;
        ssl_certificate_key  /usr/local/openresty/ssl.key;
        ssl_prefer_server_ciphers on;
        ssl_dhparam /usr/local/openrestydh4096.pem;
        client_max_body_size     6m;
        client_body_buffer_size  256k;
        location / {

        access_log /usr/local/openresty/nginx/logs/post.log post_format;

            lua_need_request_body on;
            content_by_lua '
                ngx.header.content_type = "text/html";
                ngx.say("ok")
                ngx.req.read_body()
            ';
        }
}

좋은 웹페이지 즐겨찾기