解决问题
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()
            ';
        }
}

https://blog.51cto.com/michaelkang/2164846

文档更新时间: 2022-04-19 10:52   作者:月影鹏鹏