解决问题
1: 业务系统以 post 方式上发请求日志, 需要对日志进行采集分析;
解决方法:
: 可以安装 openresty 版本 nginx;
: 可以使用官方 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()
- ';
- }
- }
来源: http://www.bubuko.com/infodetail-2744319.html